Commit Graph

12155 Commits

Author SHA1 Message Date
ligi
67589d1658 build: fix CLI params for windows LNK files (#21055)
* build: Fix CLI params for windows LNK files

closes #21054

* Remove parameters
2020-05-20 15:26:22 +03:00
Martin Holst Swende
4b33806719 core/state: avoid statedb.dbErr due to emptyCode (#21051)
* core/state: more verbose stateb errors

* core/state: fix flaw

* core/state: fixed lint

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
# Conflicts:
#	core/state/statedb.go
2020-05-20 15:26:22 +03:00
Martin Holst Swende
dc5eee4860 core/state: abort commit if read errors have occurred (#21039)
This finally adds the error check that the documentation of StateDB.dbErr
promises to do. dbErr was added in 9e5f03b6c (June 2017), and the check was
already missing in that commit. We somehow survived without it for three years.
# Conflicts:
#	core/state/statedb.go
#	core/state/statedb_test.go
2020-05-20 15:26:22 +03:00
Martin Holst Swende
ab83455837 core/state: include zero-address in state dump if present (#21038)
* Include 0x0000 address into the dump if it is present

* core/state: go fmt

Co-authored-by: Alexey Akhunov <akhounov@gmail.com>
# Conflicts:
#	core/state/dump.go
2020-05-20 15:26:22 +03:00
Marius van der Wijden
a222f5f6cb accounts/abi/bind: add void if no return args specified (#21002)
* accounts/abi/bind: add void if no return args specified

Currently the java generator generates invalid input on pure/view functions
that have no return type. e.g. `function f(uint u) view public {}`
This is not a problem in practice as people rarely ever write functions like this.

* accounts/abi/bind: use elseif instead of nested if
2020-05-20 15:26:22 +03:00
gary rong
cd6eacfd2c core/state/snapshot: fix typo (#21037)
# Conflicts:
#	core/state/snapshot/difflayer.go
2020-05-20 15:26:22 +03:00
Péter Szilágyi
f30a6fd32a core/state/snapshot: don't create storage list for non-existing accounts
# Conflicts:
#	core/state/snapshot/difflayer.go
2020-05-20 15:26:22 +03:00
Boqin Qin
b42bb4db08 core: avoid double-lock in tx_pool_test (#20984) 2020-05-20 15:26:22 +03:00
Guillaume Ballet
61d8a49ece eth/downloader: minor typo fixes in comments (#21035)
# Conflicts:
#	trie/sync.go
2020-05-20 15:26:22 +03:00
gary rong
f0ffa8a8b4 trie: fix TestBadRangeProof unit test (#21034)
# Conflicts:
#	trie/proof_test.go
2020-05-20 15:26:22 +03:00
ploui
1d0688c7cc eth: don't inadvertently enable snapshots in archive nodes (#21025)
* eth: don't reassign more cache than is being made available

* eth: don't inadvertently enable snapshot in a case where --snapshot wasn't given
# Conflicts:
#	eth/backend.go
2020-05-20 15:26:22 +03:00
Péter Szilágyi
60086a33e3 eth: skip transaction announcer goroutine on eth<65 2020-05-20 15:26:22 +03:00
Marius van der Wijden
ffc0f9e85b account/abi: remove superfluous type checking (#21022)
* accounts/abi: added getType func to Type struct

* accounts/abi: fixed tuple unpack

* accounts/abi: removed type.Type

* accounts/abi: added comment

* accounts/abi: removed unused types

* accounts/abi: removed superfluous declarations

* accounts/abi: typo
# Conflicts:
#	accounts/abi/numbers.go
2020-05-20 15:26:22 +03:00
Péter Szilágyi
3b2cbc4572 build: raise test timeout back to 10 mins (#21027) 2020-05-20 15:26:22 +03:00
Péter Szilágyi
28d3cbb176 cmd/geth: handle memfixes on 32bit arch with large RAM 2020-05-20 15:26:22 +03:00
Péter Szilágyi
99b990b0af tests: skip consensus test using 1GB RAM 2020-05-20 15:26:22 +03:00
rene
2b0cf4d1ee cmd/utils: renames flags related to http-rpc server (#20935)
* rpc flags related to starting http server renamed to http

* old rpc flags aliased and still functional

* pprof flags fixed

* renames gpo related flags

* linted

* renamed rpc flags for consistency and clarity

* added warn logs

* added more warn logs for all deprecated flags for consistency

* moves legacy flags to separate file, hides older flags under show-deprecated-flags command

* legacy prefix and moved some more legacy flags to legacy file

* fixed circular import

* added docs

* fixed imports lint error

* added notes about when flags were deprecated

* cmd/utils: group flags by deprecation date + reorder by date,

* modified deprecated comments for consistency, added warn log for --rpc

* making sure deprecated flags are still functional

* show-deprecated-flags command cleaned up

* fixed lint errors

* corrected merge conflict

* IsSet --> GlobalIsSet

* uncategorized flags, if not deprecated, displayed under misc

Co-authored-by: Martin Holst Swende <martin@swende.se>
# Conflicts:
#	cmd/geth/main.go
#	cmd/geth/usage.go
#	internal/debug/flags.go
2020-05-20 15:26:22 +03:00
Péter Szilágyi
3bea6f911c core/state/snapshot: release iterator after verification 2020-05-20 15:26:22 +03:00
Igor Mandrigin
46f9df7821 accounts/abi: move U256Bytes to common/math (#21020)
# Conflicts:
#	accounts/abi/abi_test.go
#	accounts/abi/numbers.go
#	signer/core/signed_data.go
2020-05-20 15:26:22 +03:00
Marius van der Wijden
7441eac281 accounts/abi: removed Kind from Type struct (#21009)
* accounts/abi: removed Kind from Type struct

* accounts/abi: removed unused code
2020-05-20 15:26:22 +03:00
Péter Szilágyi
f189e7e045 tests: cleanup snapshot generator goroutine leak
# Conflicts:
#	cmd/evm/staterunner.go
#	eth/tracers/tracers_test.go
#	tests/state_test.go
#	tests/state_test_util.go
#	tests/vm_test_util.go
2020-05-20 15:26:22 +03:00
Martin Holst Swende
b3a6c8eadd accounts/external: convert signature v value to 0/1 (#20997)
This fixes an issue with clef, which already transforms the signature
to use the legacy 27/28 encoding.

Fixes #20994
2020-05-20 15:26:22 +03:00
Boqin Qin
4d10d64a2f les: remove invalid use of t.Fatal in TestHandshake (#21012)
# Conflicts:
#	les/peer_test.go
2020-05-20 15:26:22 +03:00
Felix Lange
0ccaadf5a5 go.sum: run go mod tidy (#21014)
# Conflicts:
#	go.sum
2020-05-20 15:26:22 +03:00
Martin Holst Swende
28b2a2a78b accounts/external: fill account-cache if that hasn't already been done, fixes #20995 (#20998) 2020-05-20 15:26:22 +03:00
gary rong
434245bb01 core/state/snapshot: fix trie generator reporter (#21004)
# Conflicts:
#	core/state/snapshot/conversion.go
#	go.sum
2020-05-20 15:26:22 +03:00
Péter Szilágyi
5f3bcbe1c3 core/state/snapshot: fix journal nil deserialziation
# Conflicts:
#	core/state/snapshot/journal.go
2020-05-20 15:26:22 +03:00
gary rong
c646d6abf3 core/state/snapshot: implement storage iterator (#20971)
* core/state/snapshot: implement storage iterator

* core/state/snapshot, tests: implement helper function

* core/state/snapshot: fix storage issue

If an account is deleted in the tx_1 but recreated in the tx_2,
the it can happen that in this diff layer, both destructedSet
and storageData records this account. In this case, the storage
iterator should be able to iterate the slots belong to new account
but disable further iteration in deeper layers(belong to old account)

* core/state/snapshot: address peter and martin's comment

* core/state: address comments

* core/state/snapshot: fix test
# Conflicts:
#	core/state/snapshot/account.go
#	core/state/snapshot/conversion.go
#	core/state/snapshot/difflayer.go
#	core/state/snapshot/difflayer_test.go
#	core/state/snapshot/generate.go
#	core/state/snapshot/iterator.go
#	core/state/snapshot/iterator_binary.go
#	core/state/snapshot/iterator_fast.go
#	core/state/snapshot/iterator_test.go
#	core/state/snapshot/snapshot.go
#	core/state/snapshot/snapshot_test.go
#	core/state/statedb.go
#	tests/block_test_util.go
2020-05-20 15:26:22 +03:00
ucwong
177eba9806 go.mod : goupnp v1.0.0 upgrade (#20996)
# Conflicts:
#	go.mod
#	go.sum
2020-05-20 15:26:22 +03:00
Martin Holst Swende
c39d21415a signer, log: properly escape character sequences (#20987)
* signer: properly handle terminal escape characters

* log: use strconv conversion instead of custom escape function

* log: remove relection tests for nil
2020-05-20 15:26:22 +03:00
ucwong
3bf99802c6 event, whisper/whisperv6: use defer where possible (#20940)
# Conflicts:
#	whisper/whisperv6/whisper.go
2020-05-20 15:26:22 +03:00
Steven E. Harris
d047bc90cd rpc: add explicit 200 response for empty HTTP GET (#20952) 2020-05-20 15:26:22 +03:00
ucwong
4753d95fc9 go.mod: upgrade to golang-lru v0.5.4 (#20992)
golang-lru is now a go module, and the upgrade corrects a couple
of minor issues. In particular, the library could crash if you inserted
nil into an LRU cache.
# Conflicts:
#	go.mod
#	go.sum
2020-05-20 15:26:22 +03:00
Felix Lange
d5469b3b3c core: improve TestLogRebirth (#20961)
This is a resubmit of #20668 which rewrites the problematic test
without any additional goroutines. It also documents the test better.

The purpose of this test is checking whether log events are sent
correctly when importing blocks. The test was written at a time when
blockchain events were delivered asynchronously, making the check hard
to pull off. Now that core.BlockChain delivers events synchronously
during the call to InsertChain, the test can be simplified.

Co-authored-by: BurtonQin <bobbqqin@gmail.com>
# Conflicts:
#	core/blockchain_test.go
2020-05-20 15:26:22 +03:00
Julian Y
3406f9d718 rpc: make ExampleClientSubscription work with the geth API (#19483)
This corrects the call to eth_getBlockByNumber, which previously
returned this error:

  can't get latest block: missing value for required argument 1

Co-authored-by: Felix Lange <fjl@twurst.com>
# Conflicts:
#	rpc/client_example_test.go
2020-05-20 15:26:22 +03:00
Boqin Qin
9258f47717 core: add check in AddChildIndexer to avoid double lock (#20982)
This fixes a theoretical double lock condition which could occur in

    indexer.AddChildIndexer(indexer)

Nobody would ever do that though.

Co-authored-by: Felix Lange <fjl@twurst.com>
2020-05-20 15:26:22 +03:00
Marius van der Wijden
3c2b9248ed accounts/abi: added abi test cases, minor bug fixes (#20903)
* accounts/abi: added documentation

* accounts/abi: reduced usage of arguments.LengthNonIndexed

* accounts/abi: simplified reflection logic

* accounts/abi: moved testjson data into global declaration

* accounts/abi: removed duplicate test cases

* accounts/abi: reworked abi tests

* accounts/abi: added more tests for abi packing

* accounts/abi/bind: refactored base tests

* accounts/abi: run pack tests as subtests

* accounts/abi: removed duplicate tests

* accounts/abi: removed unnused arguments.LengthNonIndexed

Due to refactors to the code, we do not need the arguments.LengthNonIndexed function anymore.
You can still get the length by calling len(arguments.NonIndexed())

* accounts/abi: added type test

* accounts/abi: modified unpack test to pack test

* accounts/abi: length check on arrayTy

* accounts/abi: test invalid abi

* accounts/abi: fixed rebase error

* accounts/abi: fixed rebase errors

* accounts/abi: removed unused definition

* accounts/abi: merged packing/unpacking tests

* accounts/abi: fixed [][][32]bytes encoding

* accounts/abi: added tuple test cases

* accounts/abi: renamed getMockLog -> newMockLog

* accounts/abi: removed duplicate test

* accounts/abi: bools -> booleans
# Conflicts:
#	accounts/abi/unpack_test.go
2020-05-20 15:26:22 +03:00
Steven E. Harris
8856454979 node: shut down all node-related HTTP servers gracefully (#20956)
Rather than just closing the underlying network listener to stop our
HTTP servers, use the graceful shutdown procedure, waiting for any
in-process requests to finish.
2020-05-20 15:26:22 +03:00
Péter Szilágyi
2f13f9835a eth: fix shutdown regression to abort downloads, not just cancel 2020-05-20 15:26:22 +03:00
tgyKomgo
82171fe189 p2p/enode: update code comment (#20972)
It is possible to specify enode URLs using domain name since
commit b90cdbaa79, but the code comment still said that only
IP addresses are allowed.

Co-authored-by: admin@komgo.io <KomgoRocks2018!>
2020-05-20 15:26:22 +03:00
gary rong
91061d043e core/state/snapshot: fix binary iterator (#20970)
# Conflicts:
#	core/state/snapshot/iterator_binary.go
#	core/state/snapshot/iterator_test.go
2020-05-20 15:26:22 +03:00
gary rong
126d94fa7c trie: initial implementation for range proof (#20908)
* trie: initial implementation for range proof

* trie: add benchmark

* trie: fix lint

* trie: fix minor issue

* trie: unset the edge valuenode as well

* trie: unset the edge valuenode as nilValuenode
# Conflicts:
#	les/odr_requests.go
#	trie/proof.go
#	trie/proof_test.go
2020-05-20 15:26:22 +03:00
Marius van der Wijden
a7e120dc4c accounts/keystore: fix double import race (#20915)
* accounts/keystore: fix race in Import/ImportECDSA

* accounts/keystore: added import/export tests

* cmd/geth: improved TestAccountImport test

* accounts/keystore: added import/export tests

* accounts/keystore: fixed naming

* accounts/keystore: fixed typo

* accounts/keystore: use mutex instead of rwmutex

* accounts: use errors instead of fmt
# Conflicts:
#	accounts/keystore/keystore_test.go
#	cmd/geth/accountcmd_test.go
2020-05-20 15:26:22 +03:00
icodezjb
83857d4f4a core: mirror full node reorg logic in light client too (#20931)
* core: fix the condition of reorg

* core: fix nitpick to only retrieve head once

* core: don't reorg if received chain is longer at same diff

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
# Conflicts:
#	core/headerchain.go
2020-05-20 15:26:22 +03:00
gary rong
ad9e4241b1 all: seperate consensus error and evm internal error (#20830)
* all: seperate consensus error and evm internal error

There are actually two types of error will be returned when
a tranaction/message call is executed: (a) consensus error
(b) evm internal error. The former should be converted to
a consensus issue, e.g. The sender doesn't enough asset to
purchase the gas it specifies. The latter is allowed since
evm itself is a blackbox and internal error is allowed to happen.

This PR emphasizes the difference by introducing a executionResult
structure. The evm error is embedded inside. So if any error
returned, it indicates consensus issue happens.

And also this PR improve the `EstimateGas` API to return the concrete
revert reason if the transaction always fails

* all: polish

* accounts/abi/bind/backends: add tests

* accounts/abi/bind/backends, internal: cleanup error message

* all: address comments

* core: fix lint

* accounts, core, eth, internal: address comments

* accounts, internal: resolve revert reason if possible

* accounts, internal: address comments
# Conflicts:
#	accounts/abi/abi.go
#	accounts/abi/bind/backends/simulated.go
#	cmd/geth/retesteth.go
#	core/state/snapshot/difflayer_test.go
#	core/state/snapshot/disklayer_test.go
#	core/state/snapshot/iterator_test.go
#	core/state_processor.go
#	core/state_transition.go
#	core/vm/evm.go
#	core/vm/instructions.go
#	core/vm/jump_table.go
#	eth/api_tracer.go
#	internal/ethapi/api.go
#	les/odr_test.go
#	light/odr_test.go
#	tests/state_test_util.go
2020-05-20 15:26:22 +03:00
ucwong
b781181b28 go.mod : update fastcache to 1.5.7 (#20936)
# Conflicts:
#	go.mod
#	go.sum
2020-05-20 15:26:22 +03:00
ucwong
6f75f79ebe p2p: defer wait group done in protocol start (#20951) 2020-05-20 15:26:22 +03:00
Martin Holst Swende
e0f33c2abb core/state/snapshot: make difflayer account iterator seek operation inclusive
# Conflicts:
#	core/state/snapshot/iterator.go
#	core/state/snapshot/iterator_test.go
2020-05-20 15:26:22 +03:00
Boqin Qin
94abaf9542 snapshot: add Unlock before return (#20948)
* Forget Unlock in snapshot

* Remove Unlock before panic
# Conflicts:
#	core/state/snapshot/iterator.go
2020-05-20 15:26:22 +03:00
rene
aa2f2b742a cmd, core: remove override muir glacier and override istanbul (#20942)
# Conflicts:
#	core/genesis.go
#	eth/backend.go
#	les/client.go
2020-05-20 15:26:22 +03:00