Commit Graph

1613 Commits

Author SHA1 Message Date
Martin Holst Swende
fb500d12d5
eth/protocols/snap: make log messages more clear that sync is ongoing (#25837)
* eth/protocols/snap: make log messages more clear that sync is ongoing

* Update sync.go

Co-authored-by: Felix Lange <fjl@twurst.com>
2022-09-23 11:11:41 +03:00
Martin Holst Swende
400ab0d94f
eth/catalyst: make tests run faster (#25818) 2022-09-21 15:12:45 +02:00
Martin Holst Swende
6eb8f3225e
eth/catalyst: add locking around newpayload (#25816)
Sometimes we get stuck on db compaction, and the CL re-issues the "same" command to us multiple times. Each request get stuck on the same place, in the middle of the handler.

This changes makes it so we do not reprocess the same payload, but instead detects it early.
2022-09-21 13:48:09 +02:00
makcandrov
5d11d38f4d
eth/tracers: fix trace config for TraceCall (#25821)
Co-authored-by:  AtomicAzzaz  <AtomicAzzaz@users.noreply.github.com>
Co-authored-by:  ewile <ewile@users.noreply.github.com>
2022-09-21 09:55:48 +02:00
Péter Szilágyi
d728ba97d8
eth: fix a rare datarace on CHT challenge reply / shutdown 2022-09-20 14:14:24 +03:00
Felix Lange
b628d72766
build: upgrade to go 1.19 (#25726)
This changes the CI / release builds to use the latest Go version. It also
upgrades golangci-lint to a newer version compatible with Go 1.19.

In Go 1.19, godoc has gained official support for links and lists. The
syntax for code blocks in doc comments has changed and now requires a
leading tab character. gofmt adapts comments to the new syntax
automatically, so there are a lot of comment re-formatting changes in this
PR. We need to apply the new format in order to pass the CI lint stage with
Go 1.19.

With the linter upgrade, I have decided to disable 'gosec' - it produces
too many false-positive warnings. The 'deadcode' and 'varcheck' linters
have also been removed because golangci-lint warns about them being
unmaintained. 'unused' provides similar coverage and we already have it
enabled, so we don't lose much with this change.
2022-09-10 13:25:40 +02:00
Péter Szilágyi
de8d5fa042
eth/protocols/snap: throttle trie heal requests when peers DoS us (#25666)
* eth/protocols/snap: throttle trie heal requests when peers DoS us

* eth/protocols/snap: lower heal throttle log to debug

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

* eth/protocols/snap: fix comment

Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-09-09 11:42:57 +03:00
rjl493456442
6a575eda6f
eth/tracer: fix broken test (#25715) 2022-09-08 08:06:06 +02:00
rjl493456442
b1f6dccfba
eth, les: rework chain tracer (#25143)
This PR simplifies the logic of chain tracer and also adds the unit tests.

The most important change has been made in this PR is the state management. Whenever a tracing state is acquired there is a corresponding release function be returned as well. It must be called once the state is used up, otherwise resource leaking can happen.

And also the logic of state management has been simplified a lot. Specifically, the state provider(eth backend, les backend) should ensure the state is available and referenced. State customers can use the state according to their own needs, or build other states based on the given state. But once the release function is called, there is no guarantee of the availability of the state.


Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2022-09-07 20:25:58 +02:00
rjl493456442
dea1fb3cfc
all: cleanup tests (#25641)
Follow-up to PR #25523 to cleanup all relevant tests.
2022-09-07 20:21:59 +02:00
Felix Lange
731885809c
eth/tracers/js: improve integer types in log object (#25668)
All fields related to gas must be represented as uint64. Depth is
internally tracked as int, so it makes sense to also store it as int.
2022-09-05 14:06:16 +02:00
Martin Holst Swende
7f2890a9be
eth/fetcher: throttle peers which deliver many invalid transactions (#25573)
Co-authored-by: Felix Lange <fjl@twurst.com>
2022-09-02 17:28:33 +02:00
Sina Mahmoodi
d6a12bc7b8
eth/tracers/js: fill in log.refund field (#25661)
For some reason, an accessor method for this field exists in JS, but
the value was never actually assigned.
2022-09-02 17:08:25 +02:00
Péter Szilágyi
511bf8f188
Merge pull request #25651 from holiman/fix_snapqueue
eth/protocols/snap: fix problems due to idle-but-busy peers
2022-09-01 12:38:34 +03:00
Marius van der Wijden
95a2c221d4
eth/catalyst: prevent division by zero (#25654)
eth/catalyst: prevent diff by zero
2022-08-31 21:29:39 +03:00
Martin Holst Swende
dafa40e7a7
eth/protocols/snap: fix problems due to idle-but-busy peers 2022-08-31 17:58:18 +02:00
Martin Holst Swende
362256ebff
eth/catalyst: adjust eta for themerge (#25601)
* eth/catalyst: adjust eta for themerge

* squash

* squash

* eth/catalyst: address review concerns
2022-08-31 13:28:35 +03:00
rjl493456442
d10c280309
all: move genesis initialization to blockchain (#25523)
* all: move genesis initialization to blockchain

* core: add one more check

* core: fix tests
2022-08-30 18:22:28 +02:00
Péter Szilágyi
81bd998353
core, eth/downloader: handle spurious junk bodies from racey rollbacks (#25578)
* eth/downloader: handle junkbodies/receipts in the beacon sync

* core: check for header presence when checking for blocks
2022-08-23 14:02:51 +03:00
Péter Szilágyi
395f3d4bf6
eth/catalyst: warn less frequently if no beacon client is available (#25569)
* eth/catalyst: warn less frequently if no beacon client is available

* eth/catalyst: tweak warning frequency a bit

* eth/catalyst: some more tweaks

* Update api.go

Co-authored-by: Felix Lange <fjl@twurst.com>
2022-08-22 11:27:39 +03:00
Péter Szilágyi
02418c2fa9
Revert "eth/fetcher: don't spend too much time on transaction inclusion" (#25567)
Revert "eth/fetcher: don't spend too much time on transaction inclusion (#25524)"

This reverts commit 0ce494b60c.
2022-08-22 10:14:56 +03:00
Martin Holst Swende
0ce494b60c
eth/fetcher: don't spend too much time on transaction inclusion (#25524)
* eth/fetcher: introduce some lag in tx fetching

* eth/fetcher: change conditions a bit

* eth/fetcher: use per-batch quota check

* eth/fetcher: fix some comments

* eth/fetcher: address review concerns

* eth/fetcher: fix panic + add warn log

* eth/fetcher: fix log

* eth/fetcher: fix log

* cmd/devp2p/internal/ethtest: fix ignorign tx announcements from prev. tests

* cmd/devp2p/internal/ethtest: fix TestLargeTxRequest

This increases the number of tx relay messages the test waits for. Since
go-ethereum now processes incoming txs in smaller batches, the
announcement messages it sends are also smaller.

Co-authored-by: Felix Lange <fjl@twurst.com>
2022-08-19 16:59:36 +03:00
Sina Mahmoodi
36874b63a1
eth/filters: add global block logs cache (#25459)
This adds a cache for block logs which is shared by all filters. The cache
size of is configurable using the `--cache.blocklogs` flag.

Co-authored-by: Felix Lange <fjl@twurst.com>
2022-08-19 11:14:59 +02:00
Justin Traglia
656dc8cc00
eth, les: unlock downloader peerSet if there's an error (#25546)
Unlock peerSet if there's an error in the downloader
2022-08-19 09:02:47 +03:00
Justin Traglia
2c5648d891
all: fix some typos (#25551)
* Fix some typos

* Fix some mistakes

* Revert 4byte.json

* Fix an incorrect fix

* Change files to fails
2022-08-19 09:00:21 +03:00
rjl493456442
a41ea8a97c
all: cleanup the APIs for initializing genesis (#25473)
* all: polish tests

* core: apply feedback from Guillaume

* core: fix comment
2022-08-09 12:44:39 +03:00
Sina Mahmoodi
86de2e516e
eth/tracers: add onlyTopCall option to callTracer (#25430)
This PR allows users to pass in a config object directly to the tracers. Previously only the struct logger was configurable.

It also adds an option to the call tracer which if enabled makes it ignore any subcall and collect only information about the top-level call. See #25419 for discussion.

The tracers will silently ignore if they are passed a config they don't care about.
2022-08-09 11:04:57 +02:00
aaronbuchwald
759d795c56
eth: formatted error nit (#25499) 2022-08-09 11:23:41 +03:00
int88
e93442c6cf
eth/downloader: fix log errors of queue_test.go (#25494) 2022-08-08 16:07:54 +03:00
Guillaume Ballet
f67e54c92f
core: use TryGetAccount to read what TryUpdateAccount has written (#25458)
* core: use TryGetAccount to read where TryUpdateAccount has been used to write

* Gary's review feedback

* implement Gary's suggestion

* fix bug + rename NewSecure into NewStateTrie

* trie: add backwards-compatibility aliases for SecureTrie

* Update database.go

* make the linter happy

Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2022-08-04 16:13:18 +02:00
rjl493456442
8b53b92eb4
core, trie: rework trie committer (#25320)
* all: rework trie and trie committer

* all: get rid of internal cache in trie

* all: fixes

* trie: polish

* core, trie: address comments

* trie: fix imports

* core/state: address comments

* core/state/snapshot: polish

* trie: remove unused code

* trie: update tests

* trie: don't set db as nil

* trie: address comments

* trie: unskip test
2022-08-04 11:03:20 +03:00
lightclient
a0b88ce869
eth/gasprice/feehistory: support finalized block (#25442) 2022-08-01 19:13:30 +02:00
Sina Mahmoodi
1b34ed2ed6
eth: fix typo in catalyst api (#25460)
eth: fix typo
2022-08-01 17:33:39 +03:00
Péter Szilágyi
6fd06ab075
cmd, core, eth, les, params: add merge-passed chain config (#24538)
* cmd, core, eth, les, params: add merge-passed chain config

* eth/catalyst, params: add various warning on malfunctioning beacons

* eth/catalyst: fix warning for beacons without transition exchanges
2022-08-01 15:13:25 +03:00
Rithwik Babu
fea569f90a
eth: fix typo in comment (#25327) 2022-07-29 18:29:01 +02:00
Marius van der Wijden
377c7d799f
eth/catalyst: return 0x0 if latestvalid is pow block (#25423)
* eth/catalyst: return 0x0 if latestvalid is pow block

* eth/catalyst: return 0x0 if latestvalid is pow block

* eth/catalyst: fix header retrieval, fix sign check

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2022-07-28 16:16:15 +03:00
Marius van der Wijden
f3549814a9
eth/catalyst: return syncing not accepted (#25414)
* eth/catalyst: return syncing not accepted

* eth/catalyst: fix test
2022-07-28 16:01:35 +03:00
Péter Szilágyi
ad7106dfc4
eth/catalyst: fix NewPayload warn log when dropping due to snap sync 2022-07-28 08:46:13 +03:00
rjl493456442
9d76a9b94f
core, trie, eth, cmd: rework preimage store (#25287)
* core, trie, eth, cmd: rework preimage store

* trie: address comment
2022-07-27 20:37:04 +02:00
Marius van der Wijden
c6dcd018d2
core: eth: rpc: implement safe rpc block (#25165)
* core: eth: rpc: implement safe rpc block

* core: fix setHead, panics
2022-07-25 18:42:05 +03:00
Péter Szilágyi
f3af3fd8df
eth: support bubbling up bad blocks from sync to the engine API (#25190)
* eth: support bubbling up bad blocks from sync to the engine API

* eth/catalyst: fix typo

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>

* eth/catalyst: fix typo

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>

* Update eth/catalyst/api.go

* eth/catalyst: when forgetting bad hashes, also forget descendants

* eth/catalyst: minor bad block tweaks for resilience

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-07-25 16:51:04 +03:00
Péter Szilágyi
eb2b8cb4fd
eth/tracers/js: fix capitalization in tests 2022-07-25 16:49:16 +03:00
Delweng
b196ad1c16
all: add whitespace linter (#25312)
* golangci: typo

Signed-off-by: Delweng <delweng@gmail.com>

* golangci: add whietspace

Signed-off-by: Delweng <delweng@gmail.com>

* *: rm whitesapce using golangci-lint

Signed-off-by: Delweng <delweng@gmail.com>

* cmd/puppeth: revert accidental resurrection

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2022-07-25 13:14:03 +03:00
Seungbae.yu
d2247d9f5d
eth, internal, light: fix error string capitalization (#25364) 2022-07-25 12:53:44 +03:00
Marius van der Wijden
b2be5f956f
eth/catalyst: better warning for ttd not configured (#25394) 2022-07-25 12:06:22 +03:00
Marius van der Wijden
3b2a6b34d9
cmd/geth: eth/catalyst: enable authrpc by default (#25152)
* cmd/geth: eth/catalyst: enable authrpc by default

* eth/catalyst: rename catalyst -> Engine API in logs

* eth/catalyst: don't panic
2022-07-23 09:56:02 +02:00
rjl493456442
1657e43931
core, les, eth: port snap sync changes (#24898)
core, eth, les, trie: rework snap sync
2022-07-15 14:55:51 +03:00
Péter Szilágyi
b53d38246e
Merge pull request #25096 from lightclient/remove-version-field
all: remove version field
2022-07-14 12:13:59 +03:00
Philip Fan
3e759e28d7
eth/tracers: add initial revertReasonTracer tracer (#25265)
Adds a native tracer that returns that in case of failure returns the error message or the revert reason of a transaction.

Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-07-12 10:10:12 +02:00
Seungbae.yu
44893be0d6
core, eth: pre-allocate map in storage copy (#25279) 2022-07-12 10:08:45 +03:00
Seungbae.yu
2697e44d81
all: change format 0x%x to %#x (#25221) 2022-07-04 11:03:32 +03:00
Péter Szilágyi
de1cecb22e
eth/catalyst: disallow importing blocks via newPayload during snap sync (#25210)
* eth/catalyst: disallow importing blocks via newPayload during snap sync

* eth/catalyst: make tests pass by using full sync only

* eth/catalysts: make the import delay a bit cleaner

* eth/catalyst: fix typo

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
2022-07-01 14:38:26 +03:00
lightclient@protonmail.com
0c6f81f888
all: remove version field from rpc.API 2022-06-27 12:39:46 +02:00
lightclient
119f955686
all: remove public field from rpc.API (#25059)
all: remove public field from rpc.API
2022-06-27 13:33:13 +03:00
int88
e620fa3980
eth: fix typo (#25161) 2022-06-24 15:28:01 +03:00
Sina Mahmoodi
6135c688b8
eth/tracers: optimize goja buffer conversion (#25156)
This changes the []byte <-> Uint8Array conversion to use an
ArrayBuffer, avoiding inefficient copying of the slice data in Goja.

Co-authored-by: Felix Lange <fjl@twurst.com>
2022-06-23 18:11:47 +02:00
rjl493456442
7c7cd410d1
eth, miner: retrieve mining state from live database (#25139)
* miner: retrieve mining state from live database

* eth/catalyst: ignore stale fcu events from cl
2022-06-22 14:59:55 +03:00
lightclient
10dc5dce08
all: remove concept of public/private API definitions (#25053)
* internal/ethapi: rename PublicEthereumAPI to EthereumAPI

* eth: rename PublicEthereumAPI to EthereumAPI

* internal/ethapi: rename PublicTxPoolAPI to TxPoolAPI

* internal/ethapi: rename PublicAccountAPI to EthereumAccountAPI

* internal/ethapi: rename PrivateAccountAPI to PersonalAccountAPI

* internal/ethapi: rename PublicBlockChainAPI to BlockChainAPI

* internal/ethapi: rename PublicTransactionPoolAPI to TransactionAPI

* internal/ethapi: rename PublicDebugAPI to DebugAPI

* internal/ethapi: move PrivateDebugAPI methods to DebugAPI

* internal/ethapi: rename PublicNetAPI to NetAPI

* les: rename PrivateLightServerAPI to LightServerAPI

* les: rename PrivateLightAPI to LightAPI

* les: rename PrivateDebugAPI to DebugAPI

* les: rename PublicDownloaderAPI to DownloaderAPI

* eth,les: rename PublicFilterAPI to FilterAPI

* eth: rename PublicMinerAPI to MinerAPI

* eth: rename PublicDownloaderAPI to DownloaderAPI

* eth: move PrivateMinerAPI methods to MinerAPI

* eth: rename PrivateAdminAPI to AdminAPI

* eth: rename PublicDebugAPI to DebugAPI

* eth: move PrivateDebugAPI methods to DebugAPI

* node: rename publicAdminAPI to adminAPI

* node: move privateAdminAPI methods to adminAPI

* node: rename publicWeb3API to web3API

* eth,internal/ethapi: sync comments with previous renamings
2022-06-21 12:05:43 +03:00
Marius van der Wijden
d8f963811d
cmd, params: implement Gray Glacier hard-fork (EIP-5133) (#25088)
* cmd/geth, params: implement Gray Glacier (EIP-5133)

* cmd/evm: add gray glacier tests

* params: nitpicks

* params: fixes
2022-06-15 14:10:38 +03:00
rjl493456442
30602163d5
eth: introduce eth67 protocol (#24093)
The new protocol version removes support for GetNodeData.
See https://eips.ethereum.org/EIPS/eip-4938 for more information.

Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-06-15 12:56:47 +02:00
lightclient
3273ad1a58
eth: add missing period at end of sentences (#25058)
eth: add missing periods on end of comments
2022-06-15 09:29:23 +02:00
lightclient
1cf58c7b81
readme,eth: remove references to eth.wiki (#25086) 2022-06-14 12:59:05 +02:00
Martin Holst Swende
a907d7e81a
all: more linters (#24783)
This enables the following linters

- typecheck
- unused
- staticcheck
- bidichk
- durationcheck
- exportloopref
- gosec

WIth a few exceptions.

- We use a deprecated protobuf in trezor. I didn't want to mess with that, since I cannot meaningfully test any changes there.
- The deprecated TypeMux is used in a few places still, so the warning for it is silenced for now.
- Using string type in context.WithValue is apparently wrong, one should use a custom type, to prevent collisions between different places in the hierarchy of callers. That should be fixed at some point, but may require some attention.
- The warnings for using weak random generator are squashed, since we use a lot of random without need for cryptographic guarantees.
2022-06-13 16:24:45 +02:00
Martin Holst Swende
b60a08d2fd
eth/catalyst: remove unauthenticated 'engine' api (#24997)
Removes engine from any unauthenticated RPC service.
2022-06-08 15:36:25 +02:00
Péter Szilágyi
41e75480df
eth, les, params: log chain config a bit saner (#24904)
Previously on Geth startup we just logged the chain config is a semi-json-y format. Whilst that worked while we had a handful of hard-forks defined, currently it's kind of unwieldy. 

This PR converts that original data dump and converts it into a user friendly - alas multiline - log output.
2022-06-07 12:49:07 +02:00
Sina Mahmoodi
d9566e39bd
eth/filters: fix getLogs for pending block (#24949)
* eth/filters: fix pending for getLogs

* add pending method to test backend

* fix block range validation
2022-06-07 08:31:19 +02:00
Ikko Ashimine
096daa9a7d
eth/tracers: fix typo in 4byte_tracer_legacy.js (#25020)
indentifier -> identifier
2022-06-06 17:55:16 +02:00
lightclient
10da98072c
eth/api: use hexutil.Bytes for account range method (#25024)
eth/api: use hexutil.Bytes for range at methods
2022-06-06 17:33:05 +02:00
rjl493456442
22defa5af7
all: introduce trie owner notion (#24750)
* cmd, core/state, light, trie, eth: add trie owner notion

* all: refactor

* tests: fix goimports

* core/state/snapshot: fix ineffasigns

Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-06-06 17:14:55 +02:00
Marius van der Wijden
2227589f9b
eth/catalyst: return 0x0 on Invalid block on top of pow block (#25006) 2022-06-02 13:15:17 +02:00
Martin Holst Swende
d8a2305565
eth/tracers: add support for block overrides in debug_traceCall (#24871)
This PR adds support for block overrides when doing debug_traceCall.

- Previously, debug_traceCall against pending erroneously used a common.Hash{} stateroot when looking up the state, meaning that a totally empty state was used -- so it always failed,
- With this change, we reject executing debug_traceCall against pending.
- And we add ability to override all evm-visible header fields.
2022-06-02 11:39:36 +02:00
Marius van der Wijden
8c0c0434c9
core/beacon: prevent invalid logsBloom length panic (#24946)
* core/beacon: prevent invalid logsBloom length panic

* core/beacon: prevent negative baseFeePerGas

* Update core/beacon/types.go

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

* eth/catalys: go format

Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-05-31 11:11:50 +02:00
Boqin Qin(秦 伯钦)
03157b6efa
eth/filters: use buffered channel to avoid goroutine leak (#24928) 2022-05-30 20:35:37 +02:00
Marius van der Wijden
93fe17559b
eth/catalyst: fix edge case in NewPayload (#24955)
Fixes an issue where we would accept a NewPayload where the grandparent is already post ttd, and the parent still has a Difficulty
2022-05-30 13:28:15 +02:00
Felix Lange
9244d5cd61
all: update license headers and AUTHORS from git history (#24947) 2022-05-24 20:39:40 +02:00
Sina Mahmoodi
ba47d800b1
eth/tracers/js: drop duktape engine (#24934)
#23773 added a JS tracer which uses Goja as its engine. In this PR I remove the previous tracer which used duktape as well as remove the dependencies.

This PR also comes with 2 fixes in the Goja tracer and one small behavioural change:

    I had handled errors in the native Go functions by panicing. My oversight was that Goja only handles panics with a Goja.Value as argument. The difference is panic(goja.Value) allows JS to catch the exception whereas Interrupt(error) doesn't.
    There was a race in how I handled Stop.
    Because of 1. some of the methods that simply return nil on error (like memory.slice) now throw an exception.
2022-05-23 22:26:10 +02:00
Péter Szilágyi
34bda5eae3
core, eth, les, rpc: polish catalyst errors, add context 2022-05-20 12:15:54 +03:00
Marius van der Wijden
4a4d531052
eth/catalyst: update implementation to spec (#24802)
* eth/catalyst: return invalid payload attributes error

* eth/catalyst: implement LVH as specified, add tests

* eth/catalyst: return current block hash not header hash

* eth/catalyst: fix test

* eth/catalyst: bring error codes in line with spec
2022-05-20 11:12:12 +03:00
Eduard S
310f751639
eth/tracers/js: add memory.length method (#24887) 2022-05-19 14:35:30 +02:00
Sina Mahmoodi
bf693228a3
eth/tracers/js: goja tracer (#23773)
This adds a JS tracer runtime environment based on the Goja VM. The new
runtime replaces the duktape runtime, which will be removed soon.

Goja is implemented in Go and is faster for cases where the Go <-> JS
transition overhead dominates overall performance. It is faster because
duktape is written in C, and the transition cost includes the cost of using
cgo. Another reason for using Goja is that go-duktape is not maintained
anymore.

We expect the performace of JS tracing to be at least as good or better with
this change.
2022-05-18 16:34:18 +02:00
Marius van der Wijden
cc9fb8e21d
eth/catalyst, miner: build the execution payload async (#24866)
* eth/catalyst: build the execution payload async

* miner: added comment, added test case

* eth/catalyst: miner: move async block production to miner

* eth/catalyst, miner: support generate seal block async

* miner: rework GetSealingBlockAsync to use a passed channel

* miner: apply rjl's diff

* eth/catalyst: nitpicks

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2022-05-18 17:33:37 +03:00
Marius van der Wijden
e6fa102eb0
core, eth, internal, rpc: implement final block (#24282)
* eth: core: implement finalized block

* eth/catalyst: fix final block

* eth/catalyst: update finalized head gauge

* internal/jsre/deps: updated web3.js to allow for finalized block

* eth/catalyst: make sure only one thread can call fcu

* eth/catalyst: nitpicks

* eth/catalyst: use plain mutex

* eth: nitpicks
2022-05-18 17:30:42 +03:00
Håvard Anda Estensen
4b309c7006
all: replace non-trivial uses of package ioutil with os (#24886)
Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-05-17 14:27:04 +02:00
Marius van der Wijden
381c66caf0
eth/catalyst: set the correct LatestValidHash (#24855)
* eth/catalyst: set the correct LatestValidHash

* eth/catalyst: core: return LVH during reorg, rework invalid teminal block

* eth/catalyst: nitpicks
2022-05-17 12:32:55 +03:00
rjl493456442
39fb82bcfb
eth: fix flaky test, don't attach empty slots/proofs (#24885)
* eth/protocols/snap: don't include empty snapshot slot slice

This PR fixes the snapshot storage serving handler. In snap protocol
the response is capped by the response size. Server can cutdown the
response if the accumulated byte size exceeds the local hard limit.

It means we can meet a special scenario that there is no storage slot
included for a requested account, but we attach the proof for this
account by mistake.

So in the prover side, when it meets a empty storage response but with
a valid proof proves there are some more slots left in the trie, then
requestor will reject this response and disconnect with server.

In this PR, if there is no storage slot served for the requested account,
then no proof should be attached as well.

* eth/protocols/snap: loosen restrictions for flaky tests

* eth/catalyst: fix flaky test in catalyst
2022-05-17 11:19:51 +03:00
Håvard Anda Estensen
07508ac0e9
all: replace uses of ioutil with io and os (#24869) 2022-05-16 11:59:35 +02:00
Martin Holst Swende
646503208e
eth/protocols/snap: sort trienode heal requests by path (#24779)
* sort snap trienode heal requests

* eth/protocols/snap: remove debug code

* eth/protocols/snap: simplify sort, generate pathsets later

* eth/protocols/snap: review concern

* eth/protocols/snap: renamings

* eth/protocols/snap: add comments in Merge

* eth/protocols/snap: remove variable 'last' in Merge

* eth/protocols/snap: fix lint flaws in test

Co-authored-by: Felix Lange <fjl@twurst.com>
2022-05-10 17:37:24 +03:00
s7v7nislands
7caa2d8163
all: replace strings.Replace with string.ReplaceAll (#24835) 2022-05-09 13:13:23 +03:00
Marius van der Wijden
86d5477079
core/state/snapshot: fix race condition (#24685)
Fixes three race conditions found through fuzzing by David Theodore
2022-05-06 17:20:41 +02:00
Martin Holst Swende
7175f82495
eth/fetcher: avoid hang in tests (partial fix for #23331) (#23351)
* eth/fetcher: fix test to avoid hanging. Partial fix for #23331

* eth/filters: avoid dangling goroutines

* eth/fetcher: revert closing of proceed
2022-05-06 15:23:43 +02:00
Mateusz Morusiewicz
cef1a86df2
miner: discard interrupted blocks (#24638)
During mining, when a new head arrives and interrupts the block building, the block being built should not be commited (but discarded). Committing the interrupted block introduces unnecessary delay, and possibly causes miner to mine on the previous head, which could result in higher uncle rate.
2022-05-06 11:19:30 +02:00
EXEC
256aae0bfa
eth/filters: remove explicit continue label in filterLogs (#24795)
The loop label can be removed because this 'continue' statement
is not in a nested loop.
2022-05-05 17:58:43 +02:00
s7v7nislands
1c90d97c1e
eth/protocols/eth: fix godoc comments (#24810)
Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-05-05 17:35:36 +02:00
rjl493456442
7f6f01d46f
core: recover state when beacon sets canonical head if it's missing (#24613)
* core: recover the state in SetChainHead if the head state is missing

* core: disable test logging

* core: address comment from martin

* core: improve log level in case state is recovered

* core, eth, les, light: rename SetChainHead to SetCanonical
2022-05-05 10:36:26 +03:00
Péter Szilágyi
ecae8e4f65
cmd, eth: fix required blocks regression 2022-05-04 19:55:17 +03:00
EXEC
d6b77f661c
eth/filters: fix code comment (#24799) 2022-05-04 15:32:51 +02:00
hero5512
f94e23ca66
eth/filters: remove unused struct fields (#24782) 2022-04-29 10:07:52 +02:00
s7v7nislands
7ab15490e9
all: use 'embed' instead of go-bindata (#24744) 2022-04-25 11:15:14 +02:00
Emmanuel T Odeke
a8bb49b8ea
eth/tracers/logger: remove unnecessary comparisons in accessList.equal (#24663)
This change removes extraneous/unnecessary checks for equality
when comparing 2 accessList values A and B. Given that we validate that
their lengths of A and B are equal, if so and if every element in A is
in B, reflexively every element in B is already in A. If that weren't
the case and an element g existed in A but not in B, that would mean
that there is an extra element and hence a mathematical contradiction.

Fixes #24658
2022-04-22 01:30:15 +02:00
Ikko Ashimine
40cfe71002
eth/downloader: fix typo in downloader.go (#24704)
synchornization -> synchronization
2022-04-20 16:17:29 +02:00