Commit Graph

12463 Commits

Author SHA1 Message Date
Marius van der Wijden
9d10856e84
core, eth, internal/ethapi: create access list RPC API (#22550)
* core/vm: implement AccessListTracer

* eth: implement debug.createAccessList

* core/vm: fixed nil panics in accessListTracer

* eth: better error messages for createAccessList

* eth: some fixes on CreateAccessList

* eth: allow for provided accesslists

* eth: pass accesslist by value

* eth: remove created acocunt from accesslist

* core/vm: simplify access list tracer

* core/vm: unexport accessListTracer

* eth: return best guess if al iteration times out

* eth: return best guess if al iteration times out

* core: docstring, unexport methods

* eth: typo

* internal/ethapi: move createAccessList to eth package

* internal/ethapi: remove reexec from createAccessList

* internal/ethapi: break if al is equal to last run, not if gas is equal

* internal/web3ext: fixed arguments

* core/types: fixed equality check for accesslist

* core/types: no hardcoded vals

* core, internal: simplify access list generation, make it precise

* core/vm: fix typo

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-04-07 17:54:31 +03:00
gary rong
a600dab7e5
eth, les: fix tracers (#22473)
* eth, les: fix tracer

* eth: isolate live trie database in tracer

* eth: fix nil

* eth: fix

* eth, les: add checkLive param

* eth/tracer: fix
2021-04-07 10:30:26 +03:00
Felföldi Zsolt
2d89fe0883
les: move client pool to les/vflux/server (#22495)
* les: move client pool to les/vflux/server

* les/vflux/server: un-expose NodeBalance, remove unused fn, fix bugs

* tests/fuzzers/vflux: add ClientPool fuzzer

* les/vflux/server: fixed balance tests

* les: rebase fix

* les/vflux/server: fixed more bugs

* les/vflux/server: unexported NodeStateMachine fields and flags

* les/vflux/server: unexport all internal components and functions

* les/vflux/server: fixed priorityPool test

* les/vflux/server: polish balance

* les/vflux/server: fixed mutex locking error

* les/vflux/server: priorityPool bug fixed

* common/prque: make Prque wrap-around priority handling optional

* les/vflux/server: rename funcs, small optimizations

* les/vflux/server: fixed timeUntil

* les/vflux/server: separated balance.posValue and negValue

* les/vflux/server: polish setup

* les/vflux/server: enforce capacity curve monotonicity

* les/vflux/server: simplified requestCapacity

* les/vflux/server: requestCapacity with target range, no iterations in SetCapacity

* les/vflux/server: minor changes

* les/vflux/server: moved default factors to balanceTracker

* les/vflux/server: set inactiveFlag in priorityPool

* les/vflux/server: moved related metrics to vfs package

* les/vflux/client: make priorityPool temp state logic cleaner

* les/vflux/server: changed log.Crit to log.Error

* add vflux fuzzer to oss-fuzz

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2021-04-06 20:42:50 +02:00
Evolution404
e275b1a293
consensus/ethash: replace a magic number with it's constant (#22618) 2021-04-06 21:02:52 +03:00
Peter Simard
95219ae62d
cmd/utils: move cache sanity check to SetEthConfig (#22510)
Move the cache sanity check to the SetEthConfig function
to allow the config file to load.
2021-04-06 16:23:35 +02:00
Sina Mahmoodi
5338ce4447
internal/debug: add JSON log format and rename logging flags (#22341)
This change adds support for logging JSON records when the --log.json flag is
given. The --debug and --backtrace flags are deprecated and replaced by
--log.debug and --log.backtrace.

While changing this, it was noticed that the --memprofilerate and
--blockprofilerate were ineffective (they were always overridden even if
--pprof.memprofilerate was not set). This is also fixed.

Co-authored-by: Felix Lange <fjl@twurst.com>
2021-04-06 16:09:51 +02:00
AmitBRD
adf09aeab1
graphql: add support for tx types and tx access lists (#22491)
This adds support for EIP-2718 access list transactions in the GraphQL API.

Co-authored-by: Amit Shah <amitshah0t7@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2021-04-06 15:58:36 +02:00
piersy
706683ea72
internal/ethapi: fix eth_chainId method (#22243)
This removes the duplicated definition of eth_chainID
in package eth and updates the definition in internal/ethapi
to treat chain ID as a bigint.

Co-authored-by: Felix Lange <fjl@twurst.com>
2021-04-06 12:24:39 +02:00
Edgar Aroutiounian
c79fc209cd
core/state/snapshot: fix data race in diff layer (#22540) 2021-04-06 11:57:00 +03:00
Péter Szilágyi
73ed68988f
Merge pull request #22604 from karalabe/hashrate-capitalization-fix
all: fix miner hashRate -> hashrate on API calls
2021-03-31 19:27:23 +03:00
Péter Szilágyi
55300d4fdb
all: fix miner hashRate -> hashrate on API calls 2021-03-31 10:56:51 +03:00
Felix Lange
4a37ae510e
rpc: tighter shutdown synchronization in client subscription (#22597)
This fixes a rare issue where the client subscription forwarding loop
would attempt send on the subscription's channel after Unsubscribe has
returned, leading to a panic if the subscription channel was already
closed by the user. Example:

    sub, _ := client.Subscribe(..., channel, ...)
    sub.Unsubscribe()
    close(channel)

The race occurred because Unsubscribe called quitWithServer to tell the
forwarding loop to stop sending on sub.channel, but did not wait for the
loop to actually come down. This is fixed by adding an additional channel
to track the shutdown, on which Unsubscribe now waits.

Fixes #22322
2021-03-30 20:09:30 +02:00
Péter Szilágyi
61ff3e86b2
core/state/snapshot, ethdb: track deletions more accurately (#22582)
* core/state/snapshot, ethdb: track deletions more accurately

* core/state/snapshot: don't reset the iterator, leveldb's screwy

* ethdb: don't mess with the insert batches for now
2021-03-30 19:04:22 +03:00
Marius van der Wijden
3faae5defc
ethstats: avoid creating subscriptions on background goroutine (#22587)
This fixes an issue where the ethstats service could crash if geth was
started and then immediately stopped due to an internal error. The
cause of the crash was a nil subscription being returned by the backend,
because the background goroutine creating them was scheduled after
the backend had already shut down.

Moving the creation of subscriptions into the Start method, which runs
synchronously during startup of the node, means the returned subscriptions
can never be 'nil'.

Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
2021-03-30 15:52:03 +02:00
nebojsa94
44fe466999
core/vm: fix Byzantium address list (#22603) 2021-03-30 16:38:53 +03:00
Martin Holst Swende
59ac3c9fd3
cmd/geth: add db dumptrie command (#22563)
Adds the command "geth db dumptrie <root> <seek> <max>", to better help investigate the trie data
2021-03-30 13:57:21 +02:00
Péter Szilágyi
43a3768066
Merge pull request #22596 from holiman/snap_timelimits
eth/protocols/snap: try to prevent requests timing out
2021-03-30 14:49:59 +03:00
Marius van der Wijden
24588bacfd
cmd/puppeth: specify working directory for nodejs 15 (#22549) 2021-03-29 20:58:58 +02:00
rene
b6912c1047
core: add BlockGen.GetBalance method (#22589) 2021-03-29 20:54:49 +02:00
Martin Holst Swende
7644795950
eth/protocols/snap: try to prevent requests timing out 2021-03-29 14:17:35 +02:00
gary rong
76700ac892
core/state/pruner: move the compaction out of the pruning procedure (#22579)
The main idea behind it is: the range compaction is very expensive
which can take a few hours to finish. During this long procedure,
a lot of exceptions can occur, e.g.
- Geth is killed manually
- Geth is killed because of machine crash
- etc

In order to minimize the effect of the exceptions, the compaction
is moved out of the pruning. So that even the compaction is not
finished, the pruning is regarded as done.
2021-03-29 11:09:29 +02:00
Felix Lange
27056f62e5
cmd/devp2p: update to newer cloudflare API client (#22588)
This upgrades the cloudflare client dependency to v0.14.0. The new
version changes the API because all methods now require a context
parameter. This change also reduces the log level of the 'Skipping...'
message to debug, following a similar change in the AWS deployer.
2021-03-26 23:15:20 +02:00
Péter Szilágyi
e7f3962612
Merge pull request #22591 from karalabe/snap-detailed-timeout-logs
eth/protocols/snap: add peer id and req id to the timeout logs
2021-03-26 23:14:16 +02:00
Péter Szilágyi
099be04100
eth/protocols/snap: add peer id and req id to the timeout logs 2021-03-26 22:29:22 +02:00
Péter Szilágyi
063f78c6ba
Merge pull request #22590 from karalabe/nil-histogram
metrics/influxdb: don't push empty histograms, no measurement != 0
2021-03-26 21:43:09 +02:00
Péter Szilágyi
62379f02c6
metrics/influxdb: don't push empty histograms, no measurement != 0 2021-03-26 21:13:52 +02:00
Felix Lange
cae6b5527e
cmd/geth, consensus/ethash: add support for --miner.notify.full flag (#22558)
The PR implements the --miner.notify.full flag that enables full pending block
notifications. When this flag is used, the block notifications sent to mining
endpoints contain the complete block header JSON instead of a work package
array.

Co-authored-by: AlexSSD7 <alexandersadovskyi7@protonmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
2021-03-26 18:30:10 +01:00
Zou Guangxian
955727181b
eth: fix corner case in sync head determination (#21695)
This avoids synchronisation failures when the local header is ahead of
the local full block.
2021-03-26 18:06:25 +01:00
Péter Szilágyi
6477ea6502
Merge pull request #22586 from karalabe/resettting-histogram
eth/protocols, metrics: use resetting histograms for rare packets
2021-03-26 16:49:37 +02:00
Péter Szilágyi
2550e46269
eth/protocols, metrics: use resetting histograms for rare packets 2021-03-26 16:14:12 +02:00
Péter Szilágyi
efe0229768
Merge pull request #22581 from karalabe/network-latency-monitoring
eth/protocols, metrics, p2p: add handler performance metrics
2021-03-26 14:26:51 +02:00
Péter Szilágyi
6d7ff6acea
eth/protocols, metrics, p2p: add handler performance metrics 2021-03-26 14:00:06 +02:00
Marius van der Wijden
54c0d573d7
eth: dump rpc gas cap and tx fee cap (#22574) 2021-03-25 16:37:51 +02:00
Péter Szilágyi
4adf0b9187
Merge pull request #22573 from holiman/checkfreq
core: fix condition on header verification
2021-03-25 13:33:53 +02:00
Felix Lange
bed74b38d9
cmd/devp2p: fix comparison of TXT record value (#22572)
* cmd/devp2p: fix comparison of TXT record value

The AWS API returns quoted DNS strings, so we must encode the new value
before comparing it against the existing record content.

* cmd/devp2p: add test

* cmd/devp2p: fix typo and rename val -> newValue
2021-03-25 13:32:32 +02:00
Martin Holst Swende
497448bf90
core: fix condition on header verification 2021-03-25 11:50:14 +01:00
Martin Holst Swende
0fda25e471
eth/tracers, core: use scopecontext in tracers, provide statedb in capturestart (#22333)
Fixes the CaptureStart api to include the EVM, thus being able to set the statedb early on. This pr also exposes the struct we used internally in the interpreter to encapsulate the contract, mem, stack, rstack, so we pass it as a single struct to the tracer, and removes the error returns on the capture methods.
2021-03-25 10:13:14 +01:00
gary rong
c5df05b9a9
eth/protocols/snap: fix the flaws in the snap sync (#22553)
* eth/protocols/snap: fix snap sync

* eth/protocols/snap: fix tests

* eth: fix tiny

* eth: update tests

* eth: update tests

* core/state/snapshot: testcase for #22534

* eth/protocols/snap: fix boundary loss on full-but-proven range

* core/state/snapshot: lintfix

* eth: address comment

* eth: fix handler

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-03-24 16:33:34 +02:00
Felix Lange
ab8fd4d005
p2p/dnsdisc: rate limit resolving before checking cache (#22566)
This makes the rate limit apply regardless of whether the node is
already cached.
2021-03-24 14:37:20 +02:00
Chen Quan
15e6c27f8b
p2p: fix minor typo and remove fd parameter in checkInboundConn (#22547) 2021-03-24 13:18:29 +01:00
Felix Lange
5129cdc4f0
cmd/devp2p: skip ENR field tails properly in nodeset filter (#22565)
In Geth v1.10, we changed the structure of the "les" ENR entry. As a result, the DHT crawler that creates the DNS lists
no longer recognizes the les nodes, which is fixed in this commit. 

* cmd/devp2p: skip ENR field tails properly in nodeset filter
* cmd/devp2p: fix tail decoder for snap as well
* les: fix tail decoding in "eth" ENR entry
2021-03-24 12:32:39 +01:00
meowsbits
e862cbff95
internal/web3ext, node: migrate node admin API (Start|Stop)RPC->HTTP (#22461)
* internal/web3ext,node: migrate node admin API (Start|Stop)RPC->HTTP

Corresponding CLI flags --rpc have been moved to --http.

This moves the admin module HTTP RPC start/stop
methods to an equivalent namespace.

Rel https://github.com/ethereum/go-ethereum/pull/22263

Date: 2021-03-08 08:00:11-06:00
Signed-off-by: meows <b5c6@protonmail.com>

* internal/web3ext: fix startRPC/HTTP param count (4->5)

Date: 2021-03-16 06:13:23-05:00
Signed-off-by: meows <b5c6@protonmail.com>
2021-03-23 11:41:23 +02:00
Péter Szilágyi
477ec75323
Merge pull request #22513 from holiman/no_snap_bloom
eth/protocols/snap, eth/downloader: don't use bloom filter in snap sync
2021-03-23 11:37:32 +02:00
Péter Szilágyi
f304290b7d
Merge pull request #22551 from karalabe/snapshot-parent-get-panic
core/state/snapshot: fix panic on missing parent
2021-03-22 23:34:12 +02:00
Péter Szilágyi
a31f6d54df
core/state/snapshot: fix panic on missing parent 2021-03-22 22:41:28 +02:00
Sina Mahmoodi
8d6cc16742
cmd/geth: check block range against chain head in export cmd (#22387)
Check the input parameters against the actual head block, exit on error
2021-03-22 19:11:10 +01:00
gary rong
0c70b83e00
all: add read-only option to database (#22407)
* all: add read-only option to database

* all: fixes tests

* cmd/geth: migrate flags

* cmd/geth: fix the compact

* cmd/geth: fix the format

* cmd/geth: fix log

* cmd: add chain-readonly

* core: add readonly notion to freezer

* core/rawdb: add log

* core/rawdb: fix freezer close

* cmd: fix

* cmd, core: construct db

* core: update tests
2021-03-22 19:06:30 +01:00
MrChico
aab35600bc
accounts: eip-712 signing for ledger (#22378)
* accounts: eip-712 signing for ledger

* address review comments
2021-03-22 09:29:32 +01:00
Derek Chiang
eaccdba4ab
core: fix method comment for txpool.requestReset (#22543) 2021-03-22 09:10:51 +02:00
Tobias Hildebrandt
ec73ec092d
cmd/utils: fix compilation issue on openbsd (#22511) 2021-03-20 19:54:17 +01:00