Commit Graph

1968 Commits

Author SHA1 Message Date
Austin Roberts
627f95403f Pass loop variable to defer function
The loop variable changes before the defer executes, so we need to
pass it to the function to make sure the closure has the correct
version of the loop variable.
2022-01-07 13:58:39 -06:00
Austin Roberts
a88d316b0a Fix missing return value 2022-01-07 12:05:18 -06:00
Austin Roberts
9f28e94d66 Fix memory leak in freezer implementation
It turns out we were only notifying plugins of freezer commits and
cleaning up our record when the block being processed was greater
than MAX_UINT64.

So, uh, never.
2022-01-07 11:36:30 -06:00
Austin Roberts
1201e7c4f8 Avoid unnecessary RLP encoding
While looking for the source of a memory leak, I decided to optimize
the metatracer to avoid encoding values when there weren't any tracers
configured to received the encoded values.

I also avoided putting the EVM into debug mode when there weren't any
tracers configured.

None of these fixed the memory leak, but they still seem like good
practices. Memory leak fix is in the next commit.
2022-01-07 11:34:07 -06:00
philip-morlier
3c32c1f732 Merge tag 'v1.10.15' into develop 2022-01-05 09:49:16 -08:00
Martin Holst Swende
66a908c5e8
core/rawdb: fix double-lock causing hang (#24189)
Fixes #24159

Co-authored-by: Felix Lange <fjl@twurst.com>
2022-01-04 19:02:37 +01:00
philip-morlier
007ba02e4b final commit of 1.10.14 update 2021-12-27 14:43:35 -08:00
zgfzgf
356bbe343a
core/asm: change order of items in stringtokenTypes (#24153)
This orders the items in slice definition same as the enum values.
2021-12-26 14:58:17 +01:00
philip-morlier
15b7e55b50 Initial commit of v1.10.14 merge 2021-12-23 14:57:38 -08:00
philip-morlier
968e79b705 Merge tag 'v1.10.14' into develop 2021-12-23 10:21:12 -08:00
Felix Lange
980b7682b4
core/types: document JSON field name equivalents of DynamicFeeTx (#24143) 2021-12-22 15:32:17 +01:00
xwjack
8bbf83e7a4
core: ignore basefee when comparing with pool gasprice in txpool (#24080)
This reverts commit 9489853321.
2021-12-17 15:44:57 +01:00
Marius van der Wijden
2295640ebd
eth/catalyst: implement kintsugi-spec v3 (#24067) 2021-12-17 15:38:58 +01:00
Sina Mahmoodi
ada9c774e9
eth, les: update unclean shutdown markers regularly (#24077)
Fixes #22580

Co-authored-by: Felix Lange <fjl@twurst.com>
2021-12-17 15:18:51 +01:00
Andrei Maiboroda
3e47e38a4e
core/vm: Make INVALID a defined opcode (#24017)
* core/vm: Define 0xfe opcode as INVALID

* core/vm: Remove opInvalid as opUndefined handles it

Co-authored-by: Alex Beregszaszi <alex@rtfs.hu>
2021-12-17 13:44:05 +01:00
Paweł Bylica
81ec6b1d4c
core/vm: reverse bit order in bytes of code bitmap (#24120)
* core/vm: reverse bit order in bytes of code bitmap

This bit order is more natural for bit manipulation operations and we
can eliminate some small number of CPU instructions.

* core/vm: drop lookup table
2021-12-17 10:32:00 +01:00
Martin Holst Swende
155795be99
core/vm: avoid memory expansion check for trivial ops (#24048) 2021-12-14 11:30:20 +01:00
ucwong
adec878c1d
core/rawdb: fix error message fields in ReadLogs (#24104) 2021-12-14 11:11:05 +01:00
Alex Beregszaszi
ae8ff2661d
core/vm: remove unused code (IsStaticJump) (#24085) 2021-12-09 13:55:06 +01:00
Martin Holst Swende
db03faa10d
core, eth: improve delivery speed on header requests (#23105)
This PR reduces the amount of work we do when answering header queries, e.g. when a peer
is syncing from us.

For some items, e.g block bodies, when we read the rlp-data from database, we plug it
directly into the response package. We didn't do that for headers, but instead read
headers-rlp, decode to types.Header, and re-encode to rlp. This PR changes that to keep it
in RLP-form as much as possible. When a node is syncing from us, it typically requests 192
contiguous headers. On master it has the following effect:

- For headers not in ancient: 2 db lookups. One for translating hash->number (even though
  the request is by number), and another for reading by hash (this latter one is sometimes
  cached).
  
- For headers in ancient: 1 file lookup/syscall for translating hash->number (even though
  the request is by number), and another for reading the header itself. After this, it
  also performes a hashing of the header, to ensure that the hash is what it expected. In
  this PR, I instead move the logic for "give me a sequence of blocks" into the lower
  layers, where the database can determine how and what to read from leveldb and/or
  ancients.

There are basically four types of requests; three of them are improved this way. The
fourth, by hash going backwards, is more tricky to optimize. However, since we know that
the gap is 0, we can look up by the parentHash, and stlil shave off all the number->hash
lookups.

The gapped collection can be optimized similarly, as a follow-up, at least in three out of
four cases.

Co-authored-by: Felix Lange <fjl@twurst.com>
2021-12-07 17:50:58 +01:00
Péter Szilágyi
a25906e4c0
Merge pull request #24066 from holiman/no_no_recursion
core/vm: remove no-recursion option from config
2021-12-06 12:47:25 +02:00
rjl493456442
69686fa328
core, core/rawdb: fix transaction indexing (#24024)
This PR fixes a special corner case in transaction indexing.

When the chain is rewound by SetHead to a historical point which is even lower than the transaction indexes tail, then system will report Failed to decode block body error all the time, because the relevant blocks are already deleted.

In order to avoid this "non-critical-but-annoying" issue, we can recap the indexing target to head+1(to is excluded, so it means indexing transactions from 0 to head).
2021-12-06 11:26:03 +01:00
Martin Holst Swende
a95675d50f
core/vm: remove no-recursion option from config 2021-12-06 09:55:50 +01:00
Péter Szilágyi
cca482b4b1
Merge pull request #24047 from karalabe/delete-dead-sync-bloom
core, eth, les, trie: remove the sync bloom, used by fast sync
2021-12-03 13:55:17 +02:00
Péter Szilágyi
58d1988349
core, eth, les, trie: remove the sync bloom, used by fast sync 2021-12-03 12:32:41 +02:00
Andrei Maiboroda
b02fe5317f
core/vm: move interpreter interruption check to jump instructions (#24026)
* core/vm: Remove interpreter loop interruption check

* core/vm: Unit test for interpreter loop interruption

* core/vm: Check for interpreter loop abort on every jump
2021-12-03 11:10:26 +01:00
Paweł Bylica
9331fe28e8
core/vm: fill gaps in jump table with opUndefined (#24031) 2021-12-03 11:04:54 +01:00
Alex Beregszaszi
a0f7771962
core/vm: remove stack.pushN (#24040) 2021-12-03 10:16:49 +01:00
Taeik Lim
85064ed09b
all: fix 'the the' in comments (#24036) 2021-12-02 15:42:09 +01:00
Alex Beregszaszi
2be129b5cf
core/vm: rename opSuicide to opSelfdestruct (#24022)
The opcode was renamed in the codebase in 2017, but the functions were kept unchanged.
2021-12-01 10:33:29 +01:00
Alex Beregszaszi
9393d1fb5d
core/vm: Move interpreter.ReadOnly check into the opcode implementations (#23970)
* core/vm: Move interpreter.ReadOnly check into the opcode implementations

Also remove the same check from the interpreter inner loop.

* core/vm: Remove obsolete operation.writes flag

* core/vm: Capture fault states in logger

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

* core/vm: Remove panic added for testing

Co-authored-by: Martin Holst Swende <martin@swende.se>
2021-12-01 10:21:21 +01:00
Andrei Maiboroda
163f1665dd
core/vm: don't copy JumpTable when no EIP mods are needed (#23977) 2021-11-30 14:21:40 +02:00
Alex Beregszaszi
a69d4b273d
core/vm: Rename SHA3 instruction to KECCAK256 (#23976)
This was proposed in 2016, Solidity uses this since 2017, and evmone and other VMs use the keccak256 name. This brings geth in line with those.
2021-11-30 10:34:34 +01:00
Austin Roberts
826327a8e7 Update to develop 2021-11-29 10:41:24 -06:00
Austin Roberts
72b7820579 Merge tag 'v1.10.13' into HEAD 2021-11-29 10:16:31 -06:00
Austin Roberts
6060d4adc9 Merge tag 'v1.10.12' into HEAD 2021-11-29 10:16:13 -06:00
Paweł Bylica
1fa91729f2
core/vm: simplify error handling in interpreter loop (#23952)
* core/vm: break loop on any error

* core/vm: move ErrExecutionReverted to opRevert()

* core/vm: use "stop token" to stop the loop

* core/vm: unconditionally pc++ in the loop

* core/vm: set return data in instruction impls
2021-11-29 14:46:24 +01:00
Péter Szilágyi
c10a0a62c3
eth: request id dispatcher and direct req/reply APIs (#23576)
* eth: request ID based message dispatcher

* eth: fix dispatcher cancellation, rework fetchers idleness tracker

* eth/downloader: drop peers who refuse to serve advertised chains
2021-11-26 13:26:03 +02:00
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
Andrei Maiboroda
519cf98b69
core/vm: simplify op lookup in contract (#23974) 2021-11-25 20:10:01 +01:00
Péter Szilágyi
4ebeca19d7
Merge pull request #23967 from ipsilon/evm_jumptable_type
core/vm: use proper JumpTable type
2021-11-25 14:18:34 +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
Martin Holst Swende
9055cc14ec
core/vm, core/state/snapshot: remove unused code (#23956)
* core/state/snapshot: remove wiper functionality

* core/vm: remove unused 'unofficial' opcodes
2021-11-25 10:37:47 +02:00
Paweł Bylica
10b1cd9b1b
core/vm: use proper JumpTable type 2021-11-24 16:02:12 +01:00
Martin Holst Swende
347c37b362
core/rawdb: use AncientRange when initializing leveldb from freezer (#23612)
* core/rawdb: utilize AncientRange when initiating from freezer

* core/rawdb: remove debug sanity check
2021-11-23 12:37:26 +01:00
Péter Szilágyi
50e07a1e16
Merge pull request #23928 from holiman/no_iota
core/vm: don't use iota for opcode definitions
2021-11-23 11:50:17 +02:00
Péter Szilágyi
d9c13d407f
core, eth/downloader: fix resetting below freezer threshold 2021-11-22 11:12:51 +02:00
Martin Holst Swende
ab31fbbde1
core/vm: don't use iota for opcode definitions 2021-11-18 09:50:52 +01:00
Jesse Tane
33f2813809
cmd/geth: add flag --dev.gaslimit for dev mode (#23686)
* cmd, core: add flag --dev.gaslimit to allow configuring initial block gas limit in dev mode

* core: use provided gaslimit

Co-authored-by: Martin Holst Swende <martin@swende.se>
2021-11-16 13:45:02 +01:00
Martin Holst Swende
b7a6409cc1
core/rawdb: better error message in freezer (#23901)
* core/rawdb: better error message in freezer

* Apply suggestions from code review
2021-11-16 11:33:56 +02:00