Commit Graph

1407 Commits

Author SHA1 Message Date
Marius van der Wijden
3038e480f5
all: core rework for the merge transition (#23761)
* all: work for eth1/2 transtition

* consensus/beacon, eth: change beacon difficulty to 0

* eth: updates

* all: add terminalBlockDifficulty config, fix rebasing issues

* eth: implemented merge interop spec

* internal/ethapi: update to v1.0.0.alpha.2

                                                                 This commit updates the code to the new spec, moving payloadId into
                                                                 it's own object. It also fixes an issue with finalizing an empty blockhash.
                                                                 It also properly sets the basefee

* all: sync polishes, other fixes + refactors

* core, eth: correct semantics for LeavePoW, EnterPoS

* core: fixed rebasing artifacts

* core: light: performance improvements

* core: use keyed field (f)

* core: eth: fix compilation issues + tests

* eth/catalyst: dbetter error codes

* all: move Merger to consensus/, remove reliance on it in bc

* all: renamed EnterPoS and LeavePoW to ReachTDD and FinalizePoS

* core: make mergelogs a function

* core: use InsertChain instead of InsertBlock

* les: drop merger from lightchain object

* consensus: add merger

* core: recoverAncestors in catalyst mode

* core: fix nitpick

* all: removed merger from beacon, use TTD, nitpicks

* consensus: eth: add docstring, removed unnecessary code duplication

* consensus/beacon: better comment

* all: easy to fix nitpicks by karalabe

* consensus/beacon: verify known headers to be sure

* core: comments

* core: eth: don't drop peers who advertise blocks, nitpicks

* core: never add beacon blocks to the future queue

* core: fixed nitpicks

* consensus/beacon: simplify IsTTDReached check

* consensus/beacon: correct IsTTDReached check

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-11-26 13:23:02 +02:00
Sina Mahmoodi
1876cb443b
all: move loggers to eth/tracers (#23892)
* all: mv loggers to eth/tracers

* core/vm: minor

* eth/tracers: tmp comment out testStoreCapture

* eth/tracers: uncomment and fix logger test

* eth/tracers: simplify test

* core/vm: re-add license

* core/vm: minor

* rename LogConfig to Config
2021-11-25 14:17:09 +02:00
Péter Szilágyi
d9c13d407f
core, eth/downloader: fix resetting below freezer threshold 2021-11-22 11:12:51 +02:00
Anatole
e0761432a4
eth: fix typo in comment (#23941) 2021-11-22 02:53:16 +01:00
courtier
c52def7f11
eth/gasprice: sanitize max header and block history (#23886)
Fixes #23452
2021-11-18 19:20:36 +01:00
Sina Mahmoodi
05acc272b5
eth/tracers: make native 4byte default, remove js version (#23916) 2021-11-16 08:44:57 +01:00
Ward Bradt
e9294a7fe9
eth/tracers: add golang 4byte tracer (#23882)
* native 4byte tracer

* Update eth/tracers/native/4byte.go

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

* Update eth/tracers/native/4byte.go

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

* goimports

* eth/tracers: make 4byte tracer not care about create

Co-authored-by: Martin Holst Swende <martin@swende.se>
2021-11-11 20:20:46 +01:00
Sina Mahmoodi
c57df9ca28
core/rawdb: add slow path for getting legacy logs (#23879)
* eth/tracers: add slow path for getting legacy logs

* core/rawdb: fix test
2021-11-11 15:04:06 +01:00
Martin Holst Swende
6b9c77f060
eth/tracers: package restructuring (#23857)
* eth/tracers: restructure tracer package

* core/vm/runtime: load js tracers

* eth/tracers: mv bigint js code to own file

* eth/tracers: add method docs for native tracers

* eth/tracers: minor doc fix

* core,eth: cancel evm on nativecalltracer stop

* core/vm: fix failing test

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
2021-11-09 12:09:35 +01:00
Sina Mahmoodi
787a3b185c
eth/tracers: make native calltracer default (#23867) 2021-11-08 14:08:12 +01:00
Sina Mahmoodi
8d7e6062ec
eth/tracers: support for golang tracers + add golang callTracer (#23708)
* eth/tracers: add basic native loader

* eth/tracers: add GetResult to tracer interface

* eth/tracers: add native call tracer

* eth/tracers: fix call tracer json result

* eth/tracers: minor fix

* eth/tracers: fix

* eth/tracers: fix benchTracer

* eth/tracers: test native call tracer

* eth/tracers: fix

* eth/tracers: rm extra make

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

* eth/tracers: rm extra make

* eth/tracers: make callFrame private

* eth/tracers: clean-up and comments

* eth/tracers: add license

* eth/tracers: rework the model a bit

* eth/tracers: move tracecall tests to subpackage

* cmd/geth: load native tracers

* eth/tracers: minor fix

* eth/tracers: impl stop

* eth/tracers: add native noop tracer

* renamings

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

* eth/tracers: more renamings

* eth/tracers: make jstracer non-exported, avoid cast

* eth/tracers, core/vm: rename vm.Tracer to vm.EVMLogger for clarity

* eth/tracers: minor comment fix

* eth/tracers/testing: lint nitpicks

* core,eth: cancel evm on nativecalltracer stop

* Revert "core,eth: cancel evm on nativecalltracer stop"

This reverts commit 01bb908790a369c1bb9d3937df9325c6857bf855.

* eth/tracers: linter nits

* eth/tracers: fix output on err

Co-authored-by: Martin Holst Swende <martin@swende.se>
2021-11-05 11:48:21 +01:00
Martin Holst Swende
3bbeb94c1c
eth: make traceChain avoid OOM on long-running tracing (#23736)
This PR changes long-running chain tracing, so that it at some points releases the memory trie db, and switch over to a fresh disk-backed trie.
2021-11-04 18:54:00 +01:00
Martin Holst Swende
551bd6e721
eth/tracers: invoke enter/exit on 0-value calls to inex accounts (#23828) 2021-11-01 19:06:33 +01:00
XuDon9 Liu AKA Rapper Of CN background diablo & revelations, a man optimistic, negative, silent, active, Taoism
410e731bea
optimize the judge of invalide notification.number (#22658)
Don't bother fetching genesis

Co-authored-by: wuff1996 <33193253+wuff1996@users.noreply.github.com>
2021-10-31 19:38:48 +01:00
Martin Holst Swende
31870a59ff
eth/filters, p2p/simulations: fix benchmarks (#23806)
Some benchmarks in eth/filters were not good: they weren't reproducible, relying on geth chaindata to be present.

Another one was rejected because the receipt was lacking a backing transcation.

The p2p simulation benchmark had a lot of the warnings below, due to the framework calling both
Stop() and Close(). Apparently, the simulated adapter is the only implementation which has a Close(),
and there is no need to call both Stop and Close on it.
2021-10-29 14:37:00 +02:00
Martin Holst Swende
32150f8aa9
cmd/geth, cmd/evm, params: implement Arrow Glacier (EIP 4345) (#23810)
This PR adds support for ArrowGlacier, as defined by

    https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/arrow-glacier.md
    https://eips.ethereum.org/EIPS/eip-4345

> Starting with FORK_BLOCK_NUMBER the client will calculate the difficulty based on a fake block number suggesting to the client that the difficulty bomb is adjusting 10,700,000 blocks later than the actual block number.

This also adds support for evm t8n to return the calculated difficulty, so it can be used to construct test.
2021-10-28 22:18:14 +02:00
Preston Van Loon
b97f57882c
eth/fetcher: remove superfluous nilness-check (#23739)
* eth/fetcher: fix nilness check https://github.com/ethereum/go-ethereum/issues/23738

* eth/fetcher: Use errors.Is. PR feedback from @holiman.
2021-10-18 22:34:20 +02:00
jwasinger
011fe3eb5e
core: remove unused error from TxPool.Pending (#23720) 2021-10-13 23:00:45 +02:00
Iskander (Alex) Sharipov
778ff94794
all: fix some go-critic linter warnings (#23709)
This doesn't fix all go-critic warnings, just the most serious ones.

Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
2021-10-13 17:31:02 +02:00
noam-alchemy
633e7ef478
eth,rpc: allow for flag configured timeouts for eth_call (#23645)
* eth,rpc: allow for flag configured timeouts for eth_call

* lint: account for package-local import order

* cr: rename `rpc.calltimeout` to `rpc.evmtimeout`
2021-10-12 10:46:04 +02:00
Martin Holst Swende
6289137827
consensus/clique, core: API cleanup (#23100)
This removes some code:

- The clique engine calculated the snapshot twice when verifying headers/blocks.

- The method GetBlockHashesFromHash in Header/Block/Lightchain was only used by tests. It
  is now removed from the API.
  
- The method GetTdByHash internally looked up the number before calling GetTd(hash, num).
  In many cases, callers already had the number, and used this method just because it has a
  shorter name. I have removed the method to make the API surface smaller.
2021-10-11 23:16:46 +02:00
Marius van der Wijden
53b1420ede
params: changed CatalystBlock to TerminalTotalDifficulty (#23700)
* params: changed CatalystBlock to TerminalTotalDifficulty

* eth/catalyst: comment out unused code
2021-10-11 18:58:11 +03:00
aaronbuchwald
bcbd700367
eth/gasprice: avoid modifying TestChainConfig (#23204)
Co-authored-by: Felix Lange <fjl@twurst.com>
2021-10-11 01:52:30 +02:00
Marius van der Wijden
ee120ef865
miner: fix data race during shutdown (#23435)
This fixes a data race on worker.current by moving the call to StopPrefetcher
into the main loop.

The commit also contains fixes for two other races in unit tests of unrelated packages.
2021-10-08 20:12:52 +02:00
Martin Holst Swende
28d30b51f8
eth: close miner on exit (instead of just stopping) (#21992)
This ensures that all miner goroutines have exited before stopping the blockchain. 

Co-authored-by: Felix Lange <fjl@twurst.com>
2021-10-08 18:36:58 +02:00
Sina Mahmoodi
48496e0675
internal/ethapi: use correct signer when serving old blocks (#23683)
Fixes #23681

After the fix I get the address 0x6d6d02e83c4ced98204e20126acf27e9d87b8af2 for the
tx mentioned in the ticket, which agrees with etherscan.
2021-10-07 15:51:14 +02:00
Martin Holst Swende
307156cc46
eth/api: add rpc method to obtain which states are accessible (#23646)
This PR adds a method to the debug namespace, to iterate over the blocks and check where we have the roots on disk.
2021-10-05 08:13:00 +02:00
Ferran Borreguero
0dbb3b1601
eth/protocols/eth: replace array with counter in txn broadcaster (#23656) 2021-10-04 16:10:51 +02:00
Miro
5a0e1d88f4
eth/filters: fix TestPendingLogsSubscription (#23619)
The test did not synchronize with per-case goroutines, and thus didn't notice
that some tests were just hanging. This change adds missing synchronization
and fixes the broken tests.
2021-10-04 14:09:51 +02:00
Sina Mahmoodi
b522f5e091
eth/tracers: fix callTracer fault handling (#23667)
* eth/tracers: fix calltracer fault handling

* eth/tracers: fix calltracer indentation
2021-10-01 13:03:24 +02:00
Martin Holst Swende
3a6fe69f23
eth/protocols/snap, trie: better error-handling (#23657) 2021-09-29 15:19:40 +02:00
Ferran Borreguero
a541fbea18
eth/protocols/eth: simplify peer known block/txs caches (#23649)
* Simplify peer known block/txns cache

* Address minor changes

* Add more minor comments

* Minor changes from review
2021-09-28 13:44:07 +02:00
Martin Holst Swende
3531ca2246
eth/tracers: avoid unsyncronized mutations on trie database (#23632)
This PR fixes an issue in traceChain, where the statedb Commit operation was performed asynchronously with dereference-operations agains the underlying trie.Database instance. Due to how the reference counting works within the trie database (where parent count is recursively updated when new parents are added), doing dereferencing in the middle of Commit can cause the refcount to become wrong, leading to an inconsistent state. 

This was fixed by doing Commit/Deref from the same routine.
2021-09-28 13:06:19 +02:00
Sina Mahmoodi
783e97ef1f
core/rawdb: avoid unnecessary receipt processing for log filtering (#23147)
* core/types: rm extranous check in test

* core/rawdb: add lightweight types for block logs

* core/rawdb,eth: use lightweight accessor for log filtering

* core/rawdb: add bench for decoding into rlpLogs
2021-09-28 12:54:49 +02:00
Martin Holst Swende
ab2caaee11
eth/tracers: implement debug.intermediateRoots (#23594)
This PR implements a new debug method, which I've talked briefly about to some other client developers. It allows the caller to obtain the intermediate state roots for a block (which might be either a canon block or a 'bad' block).
2021-09-28 12:53:11 +02:00
Guillaume Ballet
443afc975c
core/state: move state account to core/types + abstracted "write account to trie" (#23567)
* core/state: abstracted "write account to trie" method

* fix appveyor build

* Apply suggestions from code review

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

* review feedback

* core/state/accounts: move Account to core/types

* core/types: rename Account -> StateAccount

* core/state: restore EncodeRLP for stateObject

* core/types: add the missing file

* more review feedback

* more review feedback

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
2021-09-28 10:48:07 +02:00
Sina Mahmoodi
ac7baeab57
eth/tracers: re-write of 4byte tracer using enter/exit (#23622)
* eth/tracers: add re-write of 4byte tracer using enter/exit

* eth/tracers: fix 4byte indent
2021-09-27 18:44:16 +02:00
Sina Mahmoodi
401354976b
core,eth: call frame tracing (#23087)
This change introduces 2 new optional methods; `enter()` and `exit()` for js tracers, and makes `step()` optiona. The two new methods are invoked when entering and exiting a call frame (but not invoked for the outermost scope, which has it's own methods). Currently these are the data fields passed to each of them:

    enter: type (opcode), from, to, input, gas, value
    exit: output, gasUsed, error

The PR also comes with a re-write of the callTracer. As a backup we keep the previous tracing script under the name `callTracerLegacy`. Behaviour of both tracers are equivalent for the most part, although there are some small differences (improvements), where the new tracer is more correct / has more information.
2021-09-17 09:31:22 +02:00
Martin Holst Swende
7ada89d4e6
eth/tracers: abort evm execution when trace is aborted (#23580) 2021-09-16 13:45:16 +02:00
Marius van der Wijden
b8d7c662cd
core, rpc: disable memory output by default in traces (#23558)
* core: cmd: invert disableMemory

* core: fix missed inversion

* cmd/evm: preserve Flags but change default value

* Apply suggestions from code review

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

Co-authored-by: Martin Holst Swende <martin@swende.se>
2021-09-13 18:59:52 +02:00
Péter Szilágyi
9e17648d8c
les: duplicate downloader and fetcher to allow progressive refactoring 2021-09-10 11:11:59 +03:00
Martin Holst Swende
62ad17fb00
Revert "eth, internal/ethapi: make RPC block miner field show block sealer correctly (#23312)" (#23466)
This reverts commit 57feabea66.
2021-08-26 08:35:37 +02:00
Péter Szilágyi
0db0b27754
Revert "Revert "eth: drop eth/65, the last non-reqid protocol version" (#23426)" (#23456)
This reverts commit c368f728c1.
2021-08-24 21:52:58 +03:00
Felföldi Zsolt
f38abc55f1
eth/gasprice: feeHistory improvements (#23422)
* eth/gasprice: cache feeHistory results

* eth/gasprice: changed feeHistory block count limitation

* eth/gasprice: do not use embedded struct in blockFees

* eth/gasprice: fee processing logic cleanup

* eth/gasprice: purge feeHistory cache at chain reorgs
2021-08-23 23:50:24 +02:00
Péter Szilágyi
c368f728c1
Revert "eth: drop eth/65, the last non-reqid protocol version" (#23426) 2021-08-20 15:14:21 +03:00
chuwt
5566e5d152
eth/downloader: fix typo in comment (#23413) 2021-08-18 13:03:41 +03:00
陈佳
57feabea66
eth, internal/ethapi: make RPC block miner field show block sealer correctly (#23312)
Makes the RPC block return the POA sealer for clique blocks on the 'miner' field (was previously zeroes)
2021-08-17 18:55:18 +02:00
Péter Szilágyi
fd604becbb
Merge pull request #23120 from karalabe/drop-eth-65
eth: drop eth/65, the last non-reqid protocol version
2021-08-13 11:52:47 +03:00
gary rong
6d175460df
cmd, core, eth, miner: deprecate miner.gastarget flag (#23213) 2021-08-10 11:28:33 +03:00
Martin Holst Swende
0658712f65
core: check if sender is EOA (#23303)
This adds a check to verify that a sender-account does not have code, which means that the codehash is either `emptyCodeHash` _OR_ not present. The latter occurs IFF the sender did not previously exist, a situation which can only occur with zero cost gasprices.
2021-08-07 19:38:18 +02:00