Commit Graph

11211 Commits

Author SHA1 Message Date
Felix Lange 96fb839133
rlp: improve nil pointer handling (#20064)
* rlp: improve nil pointer handling

In both encoder and decoder, the rules for encoding nil pointers were a
bit hard to understand, and didn't leave much choice. Since RLP allows
two empty values (empty list, empty string), any protocol built on RLP
must choose either of these values to represent the null value in a
certain context.

This change adds choice in the form of two new struct tags, "nilString"
and "nilList". These can be used to specify how a nil pointer value is
encoded. The "nil" tag still exists, but its implementation is now
explicit and defines exactly how nil pointers are handled in a single
place.

Another important change in this commit is how nil pointers and the
Encoder interface interact. The EncodeRLP method was previously called
even on nil values, which was supposed to give users a choice of how
their value would be handled when nil. It turns out this is a stupid
idea. If you create a network protocol containing an object defined in
another package, it's better to be able to say that the object should be
a list or string when nil in the definition of the protocol message
rather than defining the encoding of nil on the object itself.

As of this commit, the encoding rules for pointers now take precedence
over the Encoder interface rule. I think the "nil" tag will work fine
for most cases. For special kinds of objects which are a struct in Go
but strings in RLP, code using the object can specify the desired
encoding of nil using the "nilString" and "nilList" tags.

* rlp: propagate struct field type errors

If a struct contained fields of undecodable type, the encoder and
decoder would panic instead of returning an error. Fix this by
propagating type errors in makeStruct{Writer,Decoder} and add a test.
2019-09-13 11:10:57 +02:00
Rob Mulholand 3b6c9902f3 core: remove unused gas return in ApplyTransaction (#20065) 2019-09-12 22:22:22 +03:00
Péter Szilágyi efe123759a
Revert "build: switch PPA from Gophers dep to manual download" (#20061) 2019-09-12 14:23:34 +03:00
Péter Szilágyi 8eb646a96d
Merge pull request #20059 from karalabe/ppa-manual-go
build: switch PPA from Gophers dep to manual download
2019-09-12 13:52:39 +03:00
Péter Szilágyi c02d5bc5a9
build: switch PPA from Gophers dep to manual download 2019-09-12 13:41:13 +03:00
Péter Szilágyi 71251c7296
Merge pull request #20058 from karalabe/go1.13
travis, Dockerfile, appveyor: bump to Go 1.13
2019-09-12 12:34:15 +03:00
Péter Szilágyi 2469c4ecd4
travis, Dockerfile, appveyor: bump to Go 1.13 2019-09-12 11:09:11 +03:00
Felix Lange 39b0b1a1a6
all: make unit tests work with Go 1.13 (#20053)
Most of these changes are related to the Go 1.13 changes to test binary
flag handling. 

* cmd/geth: make attach tests more reliable

This makes the test wait for the endpoint to come up by polling
it instead of waiting for two seconds.

* tests: fix test binary flags for Go 1.13

Calling flag.Parse during package initialization is prohibited
as of Go 1.13 and causes test failures. Call it in TestMain instead.

* crypto/ecies: remove useless -dump flag in tests

* p2p/simulations: fix test binary flags for Go 1.13

Calling flag.Parse during package initialization is prohibited
as of Go 1.13 and causes test failures. Call it in TestMain instead.

* build: remove workaround for ./... vendor matching

This workaround was necessary for Go 1.8. The Go 1.9 release changed
the expansion rules to exclude vendored packages.

* Makefile: use relative path for GOBIN

This makes the "Run ./build/bin/..." line look nicer.

* les: fix test binary flags for Go 1.13

Calling flag.Parse during package initialization is prohibited
as of Go 1.13 and causes test failures. Call it in TestMain instead.
2019-09-11 14:41:22 +02:00
Martin Holst Swende 91b7349509 tests: expose internal RunNoVerify method (#20051) 2019-09-11 13:46:14 +02:00
Nguyen Kien Trung 52a967cfab eth: remove unused field (#20049) 2019-09-11 01:38:42 +03:00
Péter Szilágyi 305ed955db
Merge pull request #20038 from holiman/minor_encodingfix
core/state: optimize some internals during encoding
2019-09-10 17:12:06 +03:00
Martin Holst Swende 72045dff4f
core/state: optimize some internals during encoding 2019-09-10 15:15:34 +02:00
Péter Szilágyi 46b437f39c
Merge pull request #20047 from karalabe/counter-to-gauge
core, metrics, p2p: switch some invalid counters to gauges
2019-09-10 15:23:20 +03:00
Péter Szilágyi 72d5a27a39
core, metrics, p2p: switch some invalid counters to gauges 2019-09-10 14:39:07 +03:00
Péter Szilágyi 4f6bf2f1c5
Merge pull request #20046 from karalabe/graphql-fix-web-and-decoding
common, graphql: fix hash/address decoding + UI content type
2019-09-10 13:33:01 +03:00
Péter Szilágyi 49b86a2859
common, graphql: fix hash/address decoding + UI content type 2019-09-10 12:20:36 +03:00
Flash Sheridan cea2c80445 README: accounts in alloc field should exist (#20005)
* Accounts in alloc field must already exist

Note that accounts in alloc field must already exist, as pointed out by Simeon Vanov in https://gettoshare.com/2017/10/30/how-to-use-genesis-json-alloc-property/

* Change wording per PR review comment

* README: minor fixups
2019-09-10 12:06:26 +03:00
Péter Szilágyi 67bfc93053
Merge pull request #20033 from karalabe/docker-expose-graphql
Dockerfile: expose GraphQL ports
2019-09-04 15:13:54 +03:00
Péter Szilágyi ce2da832ac
Dockerfile: expose GraphQL ports 2019-09-04 14:46:07 +03:00
Péter Szilágyi b4a4a4db71
params: begin Geth v1.9.4 release cycle 2019-09-03 12:12:53 +03:00
Péter Szilágyi cfbb969da8
params: release Geth v1.9.3 stable 2019-09-03 12:00:38 +03:00
SjonHortensius 1611815b8d cmd/utils: reduce light.maxpeers default for clients to 1/10th (#19933)
Currently light.maxpeers is 100 - after this change it's 10 for non-servers.

Fixes #19820
2019-09-03 10:43:35 +02:00
Péter Szilágyi b8a9457139
Merge pull request #19915 from holiman/filltx
internal/ethapi: implement fillTransaction
2019-09-03 11:38:11 +03:00
Felix Lange af16ca177f
rpc: raise limit in TestClientNotificationStorm (#19999) 2019-09-02 12:05:07 +02:00
winsvega cedf8be435 retesteth: enable maxResults in AccountRange (#20020) 2019-09-02 11:49:49 +02:00
Péter Szilágyi d5bd38384c
Merge pull request #20019 from holiman/minor_adminfix
eth: disallow overwrite files via admin.exportChain
2019-08-30 15:35:43 +03:00
Martin Holst Swende 292cf7c649
eth: disallow overwrite files via admin.exportChain 2019-08-30 10:39:29 +02:00
gary rong 396f1dd87b les: fix panic (#20013) 2019-08-27 15:29:00 +02:00
gary rong 68502595f6 les: wait for all task goroutines before dropping the peer (#20010)
* les: wait all task routines before drop the peer

* les: address comments

* les: fix issue
2019-08-27 14:07:25 +03:00
Flash Sheridan a978adfd7c README: change chainID to <arbitrary positive integer> (#20002)
* Change chainId in genesis block to 8888 from 0 

Change chainId in genesis block to 8888 from 0 per Moriteru in https://ethereum.stackexchange.com/a/28082/40230.

* Replace 8888 with “<arbitrary positive integer>”

Per PR review, replace Moriteru’s arbitrary positive integer 8888 with “<arbitrary positive integer>” in chainId field.
2019-08-26 10:44:05 +03:00
Péter Szilágyi cc9eb91d30
Merge pull request #20004 from karalabe/istanbul-override
cmd, core, eth, les: support --override.istanbul
2019-08-23 12:38:05 +03:00
Péter Szilágyi e39b2a2bde
acmd, core, eth, les: support --override.istanbul 2019-08-23 12:09:27 +03:00
Péter Szilágyi c8a1c0a115
Merge pull request #19993 from karalabe/istanbul-eip-integration
core/vm: enable istanbul EIPs in the jump table
2019-08-23 11:55:43 +03:00
Martin Holst Swende 4aeeddc658
tests: implement Istanbul support 2019-08-23 10:01:09 +02:00
Martin Holst Swende e126b0836a
retesteth: implement istanbul support 2019-08-23 09:48:40 +02:00
SjonHortensius 961aa0533f rpc: enable compression on HTTP transport (#19997)
This change adds support for gzip encoding on HTTP responses.
Gzip encoding is used when the client sets the 'accept-encoding: gzip' header.
Original change by @brianosaurus, with fixes from @SjonHortensius.
2019-08-22 15:18:39 +02:00
Felix Lange 54b271a86d
crypto: add SignatureLength constant and use it everywhere (#19996)
Original change by @jpeletier
2019-08-22 15:14:06 +02:00
alexwang b90cdbaa79 p2p/enode: allow DNS names in enode URLs (#18524) 2019-08-22 14:23:40 +02:00
SjonHortensius 4d358b9fc0 cmd/utils: customize cli.HelpPrinter to fix alignment (#19956)
This copies cli.printHelp but changes minwidth to 38. Custom flag
code is improved to print the default value using cli.FlagStringer like
all built-in flags do.
2019-08-22 13:32:26 +02:00
Péter Szilágyi 1eaf66ae60
Merge pull request #19995 from karalabe/ios-notag
build: gomobile automaticall adds the ios tag, don't duplicate
2019-08-22 14:18:51 +03:00
Péter Szilágyi 4ef5e9746b
build: gomobile automaticall adds the ios tag, don't duplicate 2019-08-22 14:16:48 +03:00
Péter Szilágyi 060e33fb4c
core/vm: enable istanbul EIPs in the jump table 2019-08-22 13:41:55 +03:00
Andrey Petrov 46ec63b849 ethdb/dbtest: addd test suite for ethdb backends (#19960)
- Move the existing tests from memorydb into a generalized testsuite
that can be run by any ethdb backend implementation.
- Add several more test cases to clarify some non-obvious nuances when
implementing a custom ethdb backend, such as the behaviour of
NewIteratorWithPrefix vs NewIteratorWithStart.
- Add leveldb to the testsuite using in-memory storage for fast
execution.
2019-08-22 11:47:24 +02:00
lmittmann 1cd5bf080e common: unify hex prefix check code (#19937) 2019-08-22 11:45:07 +02:00
HackyMiner 7c229941ac core: log chain reorg/split metrics (#18950)
* core: log chain reorg/split metrics

* core: report 1-block reorgs on the metrics too
2019-08-22 12:28:23 +03:00
Péter Szilágyi ac23073619
Merge pull request #19992 from karalabe/fix-blake2b-386-2
crypto/blake2b: fix 386, round 2
2019-08-22 12:27:54 +03:00
Péter Szilágyi 8e391cec43
crypto/blake2b: fix 386, round 2 2019-08-22 12:24:11 +03:00
Péter Szilágyi 5b2c47a575
Merge pull request #19990 from karalabe/fix-blake2b-386
crypto/blake2b: fix non-amd64 builds
2019-08-22 11:50:40 +03:00
Péter Szilágyi 8517dd463d
crypto/blake2b: fix non-amd64 builds 2019-08-22 11:22:16 +03:00
Péter Szilágyi 22fdbee8ed
Merge pull request #19972 from keep-network/istanbul-eip-152-blake2b-f-precompile
core/vm, crypto/blake2b: add BLAKE2b compression func at 0x09
2019-08-22 11:09:31 +03:00