Commit Graph

12759 Commits

Author SHA1 Message Date
Felix Lange
836c647bdd
eth: unregister peer only when handler exits (#22908)
This removes the error log message that says 

    Ethereum peer removal failed ... err="peer not registered"

The error happened because removePeer was called multiple
times: once to disconnect the peer, and another time when the
handler exited. With this change, removePeer now has the sole
purpose of disconnecting the peer. Unregistering happens exactly
once, when the handler exits.
2021-05-25 22:20:36 +02:00
Felix Lange
4d33de9b49
rlp: optimize big.Int decoding for size <= 32 bytes (#22927)
This change grows the static integer buffer in Stream to 32 bytes,
making it possible to decode 256bit integers without allocating a
temporary buffer.

In the recent commit 088da24, Stream struct size decreased from 120
bytes down to 88 bytes. This commit grows the struct to 112 bytes again,
but the size change will not degrade performance because Stream
instances are internally cached in sync.Pool.

    name             old time/op    new time/op    delta
    DecodeBigInts-8    12.2µs ± 0%     8.6µs ± 4%  -29.58%  (p=0.000 n=9+10)

    name             old speed      new speed      delta
    DecodeBigInts-8   230MB/s ± 0%   326MB/s ± 4%  +42.04%  (p=0.000 n=9+10)
2021-05-25 21:56:25 +02:00
ucwong
017cf71fbd
rlp, tests/fuzzers/bls12381: gofmt (#22937) 2021-05-25 10:14:39 +02:00
Fire Man
93407b14a6
core: make txpool free space calculation more accurate (#22933) 2021-05-24 14:34:38 +02:00
Felix Lange
154ca32a8a
rlp: optimize byte array handling (#22924)
This change improves the performance of encoding/decoding [N]byte.

    name                     old time/op    new time/op    delta
    DecodeByteArrayStruct-8     336ns ± 0%     246ns ± 0%  -26.98%  (p=0.000 n=9+10)
    EncodeByteArrayStruct-8     225ns ± 1%     148ns ± 1%  -34.12%  (p=0.000 n=10+10)

    name                     old alloc/op   new alloc/op   delta
    DecodeByteArrayStruct-8      120B ± 0%       48B ± 0%  -60.00%  (p=0.000 n=10+10)
    EncodeByteArrayStruct-8     0.00B          0.00B          ~     (all equal)
2021-05-22 15:10:16 +02:00
Felix Lange
0d076d92db
rlp: use atomic.Value for type cache (#22902)
All encoding/decoding operations read the type cache to find the
writer/decoder function responsible for a type. When analyzing CPU
profiles of geth during sync, I found that the use of sync.RWMutex in
cache lookups appears in the profiles. It seems we are running into
CPU cache contention problems when package rlp is heavily used
on all CPU cores during sync.

This change makes it use atomic.Value + a writer lock instead of
sync.RWMutex. In the common case where the typeinfo entry is present in
the cache, we simply fetch the map and lookup the type.
2021-05-22 13:34:29 +02:00
gary rong
59f259b058
miner/stress: update stress tests (#22919)
This PR updates the miner stress tests and moves them to standalone
packages, so that they can be run directly.
2021-05-21 20:52:51 +02:00
Péter Szilágyi
6bc72783f6
Merge pull request #22921 from karalabe/les-simplify-reqids
les: generate random nums directly, not via strange conversions
2021-05-21 12:51:56 +03:00
Péter Szilágyi
835fe06f1d
les: generate random nums directly, not via strange conversions 2021-05-21 12:36:04 +03:00
Evolution404
81662fe827
core/rawdb: handle prefix in table.compact method (#22911) 2021-05-21 10:33:59 +02:00
Martin Holst Swende
a6c462781f
EIP-1559: miner changes (#22896)
* core/types, miner: create TxWithMinerFee wrapper, add EIP-1559 support to TransactionsByMinerFeeAndNonce

miner: set base fee when creating a new header, handle gas limit, log miner fees

* all: rename to NewTransactionsByPriceAndNonce

* core/types, miner: rename to NewTransactionsByPriceAndNonce + EffectiveTip

miner: activate 1559 for testGenerateBlockAndImport tests

* core,miner: revert naming to TransactionsByPriceAndTime

* core/types/transaction: update effective tip calculation logic

* miner: update aleut to london

* core/types/transaction_test: use correct signer for 1559 txs + add back sender check

* miner/worker: calculate gas target from gas limit

* core, miner: fix block  gas limits for 1559

Co-authored-by: Ansgar Dietrichs <adietrichs@gmail.com>
Co-authored-by: lightclient@protonmail.com <lightclient@protonmail.com>
2021-05-21 09:59:26 +02:00
Felix Lange
16bc57438b
p2p/dnsdisc: fix crash when iterator closed before first call to Next (#22906) 2021-05-20 09:24:41 +02:00
Péter Szilágyi
3e795881ea
eth, p2p/msgrate: move peer QoS tracking to its own package and use it for snap (#22876)
This change extracts the peer QoS tracking logic from eth/downloader, moving
it into the new package p2p/msgrate. The job of msgrate.Tracker is determining
suitable timeout values and request sizes per peer.

The snap sync scheduler now uses msgrate.Tracker instead of the hard-coded 15s
timeout. This should make the sync work better on network links with high latency.
2021-05-19 14:09:03 +02:00
lightclient
b3a1fda650
cmd/utils: expand tilde in --jspath (#22900) 2021-05-18 19:54:10 +02:00
Felix Lange
088da24ebf
rlp: improve decoder stream implementation (#22858)
This commit makes various cleanup changes to rlp.Stream.

* rlp: shrink Stream struct

This removes a lot of unused padding space in Stream by reordering the
fields. The size of Stream changes from 120 bytes to 88 bytes. Stream
instances are internally cached and reused using sync.Pool, so this does
not improve performance.

* rlp: simplify list stack

The list stack kept track of the size of the current list context as
well as the current offset into it. The size had to be stored in the
stack in order to subtract it from the remaining bytes of any enclosing
list in ListEnd. It seems that this can be implemented in a simpler
way: just subtract the size from the enclosing list context in List instead.
2021-05-18 12:10:27 +02:00
Felix Lange
3e6f46caec
p2p/discover/v4wire: use optional RLP field for EIP-868 seq (#22842)
This changes the definitions of Ping and Pong, adding an optional field
for the sequence number. This field was previously encoded/decoded using
the "tail" struct tag, but using "optional" is much nicer.
2021-05-18 11:48:41 +02:00
Shane Bammel
32c1ed8a9c
core/forkid: fix off-by-one bug (#22879)
* forkid: added failing test

* forkid: fixed off-by-one bug
2021-05-18 11:37:18 +03:00
Evolution404
b7a91663ab
core/asm: fix the bug of "00" prefix number (#22883) 2021-05-18 10:22:58 +02:00
Martin Holst Swende
bb9f9ccf4f
core/rawdb: wait for background freezing to exit when closing freezer (#22878) 2021-05-18 01:30:01 +02:00
Martin Holst Swende
67e7f61af7
core: fix failing tests (#22888)
This PR fixes two errors that regressed when EIP-1559 was merged.
2021-05-18 01:10:28 +02:00
Martin Holst Swende
94451c2788
all: implement EIP-1559 (#22837)
This is the initial implementation of EIP-1559 in packages core/types and core.
Mining, RPC, etc. will be added in subsequent commits.

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: lightclient@protonmail.com <lightclient@protonmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2021-05-17 15:13:22 +02:00
Martin Holst Swende
14bc6e5130
consensus/ethash: change eip3554 from 9.5M to 9.7M (#22870) 2021-05-17 10:49:23 +02:00
lightclient
597ecb39cc
cmd/evm: return json error if unmarshalling from stdin fails (#22871)
* cmd/evm: return json error if unmarshalling from stdin fails

* cmd/evm: make error capitalizations uniform (all lowercase starts)

* cmd/evm: capitalize error sent directly to stderror
2021-05-17 08:52:32 +02:00
Martin Holst Swende
addd8824cf
cmd/geth, eth, core: snapshot dump + unify with trie dump (#22795)
* cmd/geth, eth, core: snapshot dump + unify with trie dump

* cmd/evm: dump API fixes

* cmd/geth, core, eth: fix some remaining errors

* cmd/evm: dump - add limit, support address startkey, address review concerns

* cmd, core/state, eth: minor polishes, fix snap dump crash, unify format

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-05-12 11:05:39 +03:00
Péter Szilágyi
1cca781a02
Merge pull request #22840 from holiman/eip_3554
consensus/ethash: implement EIP-3554 (bomb delay)
2021-05-12 10:19:08 +03:00
Guillaume Ballet
a2c456a526
core: ensure a broken trie invariant crashes genesis creation (#22780)
* Ensure state could be created in ToBlock

* Fix rebase errors

* use a panic instead
2021-05-11 18:12:10 +03:00
Péter Szilágyi
f34f749e81
Merge pull request #22857 from karalabe/tracer-stack-fix-2
eth/tracers: do the JSON serialization via .js to capture C faults
2021-05-11 17:21:04 +03:00
Péter Szilágyi
0524cede37
eth/tracers: do the JSON serialization via .js to capture C faults 2021-05-11 16:23:54 +03:00
Ryan Schneider
ca98080798
cmd/geth, eth/gasprice: add configurable threshold to gas price oracle (#22752)
This adds a cmd line parameter `--gpo.ignoreprice`, to make the gas price oracle ignore transactions below the given threshold.
2021-05-11 11:25:51 +02:00
Felix Lange
643fd0efc6
core/types: remove support for legacy receipt/log storage encoding (#22852)
* core/types: remove support for legacy receipt storage encoding

* core/types: remove support for legacy log storage encoding
2021-05-11 11:43:35 +03:00
Felix Lange
e536bb52ff
eth/protocols/snap: adapt to uint256 API changes (#22851) 2021-05-10 13:35:07 +02:00
Felix Lange
c0e201b690
eth/protocols/eth, les: avoid Raw() when decoding HashOrNumber (#22841)
Getting the raw value is not necessary to decode this type, and
decoding it directly from the stream is faster.
2021-05-10 12:38:54 +02:00
Martin Holst Swende
ae5fcdc67f
go.mod: upgrade to github.com/holiman/uint256 v1.2.0 (#22745) 2021-05-10 12:29:33 +02:00
Ceelog
f19a679b09
cmd/geth: remove reference to monitor command (#22844)
'geth monitor' subcommand is no longer supported.
2021-05-10 12:19:32 +02:00
Marius Kjærstad
7ab7acfded
build: upgrade -dlgo version to Go 1.16.4 (#22848) 2021-05-10 12:18:42 +02:00
Felix Lange
700df1442d
rlp: add support for optional struct fields (#22832)
This adds support for a new struct tag "optional". Using this tag, structs used
for RLP encoding/decoding can be extended in a backwards-compatible way,
by adding new fields at the end.
2021-05-07 14:37:13 +02:00
Martin Holst Swende
17b1be2661
consensus/ethash: implement EIP-3554 (bomb delay) 2021-05-07 14:04:54 +02:00
Martin Holst Swende
8a070e8f7d
consensus/clique: add some missing checks (#22836) 2021-05-07 10:31:01 +02:00
Martin Holst Swende
a5669ae292
core, params: implement EIP-3529 (#22733)
* core, params: implement EIP-3529

* core/vm: add london instructionset

* core/vm: add method doc for EIP enabler

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-05-07 09:25:32 +03:00
Péter Szilágyi
e77ef8fa8a
Merge pull request #22809 from holiman/alt_3541
core: implement EIP-3541
2021-05-07 08:19:21 +03:00
Paweł Bylica
e69130d9f1
core/vm, params: implement EIP 3541 2021-05-06 11:28:46 +02:00
Martin Holst Swende
cc606be74c
all: define London+baikal, undefine yolov3, add london override flag (#22822)
* all: define London+baikal, undefine yolov3, add london override flag

* cmd, core, params: add baikal genesis definition
2021-05-06 12:07:42 +03:00
Evgeny Danilenko
df20b3b982
core/vm: avoid duplicate log in json logger (#22825) 2021-05-06 10:46:27 +02:00
Felix Lange
37b5595456 params: begin v1.10.4 release cycle 2021-05-05 13:21:13 +02:00
Felix Lange
991384a7f6 params: go-ethereum v1.10.3 stable 2021-05-05 13:20:06 +02:00
rene
0f3a1e7f9b
cmd/devp2p/internal/ethtest: send simultaneous requests on one connection (#22801)
This changes the SimultaneousRequests test to send the requests from the same
connection, as it doesn't really make sense to test whether a node can respond
to two requests with different request IDs from separate connections.
2021-05-05 12:27:27 +02:00
Felix Lange
41671d449f
build: fix windows installer build for NSIS v3.05 (#22821)
With the update to a newer AppVeyor build image, creating the Windows
installer no longer worked because of a string quoting error in EnvVarUpdate.nsh.

This applies the fix recommended in https://stackoverflow.com/questions/62081765.
2021-05-05 12:19:51 +02:00
Felix Lange
3a2b29c1ed
appveyor.yml: upgrade to VisualStudio 2019 image (#22811) 2021-05-04 23:39:09 +03:00
Felix Lange
973ad66b49
build: fix iOS framework build (#22813)
This fixes a regression introduced in #22804.
2021-05-04 21:45:45 +02:00
Felix Lange
d107f90d1c
go.mod: go mod tidy (#22814)
This updates go.mod for the addition of golang.org/x/sync.
2021-05-04 21:45:21 +02:00