Commit Graph

85 Commits

Author SHA1 Message Date
Marius van der Wijden
78429f7733
beacon/engine: don't omit empty withdrawals in ExecutionPayloadBodies (#26698)
This ensures the "withdrawals" field will always be present in responses
to getPayloadBodiesByRangeV1 and getPayloadBodiesByHashV1.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2023-03-07 16:30:04 +01:00
Marius van der Wijden
5bc2ef984f
core, eth/catalyst: fix race conditions in tests (#26790)
Fixes a race in TestNewPayloadOnInvalidTerminalBlock where setting the TTD raced with
the miner. Solution: set the TTD on the blockchain config not the genesis config.

Also fixes a race in CopyHeader which resulted in race reports all over the place.
2023-03-06 23:32:27 +01:00
Péter Szilágyi
cd31f2dee2
all: change chain head markers from block to header (#26777) 2023-03-02 08:29:15 +02:00
Péter Szilágyi
b3ae073488
eth: use the last announced finalized block as the sync ancient limit (#26685) 2023-02-23 13:22:41 +02:00
Roman Krasiuk
15e5e6176b
eth/catalyst: request too large error (#26722)
The method `GetPayloadBodiesByRangeV1` now returns "-38004: Too large request" error if the requested range is too large, according to spec

Co-authored-by: Martin Holst Swende <martin@swende.se>
2023-02-17 13:30:38 -05:00
Marius van der Wijden
6428663faf
eth/catalyst: send INVALID instead of INVALID_BLOCK_HASH (#26696)
This change will break one hive test, but pass another and it will be the better way going forward
2023-02-17 05:25:09 -05:00
Marius van der Wijden
dbd6c1324d
eth/catalyst: return error if withdrawals are nil post-shanghai (#26691)
Spec: https://github.com/ethereum/execution-apis/blob/main/src/engine/shanghai.md#request
2023-02-14 13:39:00 -05:00
Marius van der Wijden
6a148dd5c3
eth/catalyst: disallow forkchoiceupdate v1 post-shanghai (#26645) 2023-02-09 10:53:22 +02:00
jwasinger
0c9eb8c9a4
eth/catalyst: make getPayloadBodiesByRange take hex inputs (#26624)
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
2023-02-08 10:04:40 -05:00
Marius van der Wijden
2f73f4f028
eth/catalyst,miner: include withdrawals in payload id calculation (#26554)
According to the spec the payloadID needs to be random or dependent on all arguments, to prevent two payloads from clashing. This change adds withdrawals into the payload derivation. 

---------

Co-authored-by: lightclient@protonmail.com <lightclient@protonmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-02-07 13:16:53 -05:00
Felföldi Zsolt
3a5aceed8f
beacon/engine: move core/beacon to beacon/engine (#26616)
This PR moves core/beacon to beacon/engine so that beacon-chain related code has its own top level package which also can house the the beacon lightclient-code.
2023-02-06 10:37:58 -05:00
Marius van der Wijden
9826cd65bc
eth/catalyst: implement engine_getPayloadBodiesByHash/Range methods (#26232)
This change implements engine_getPayloadBodiesByHash and engine_getPayloadBodiesByRange, according to the specification at https://github.com/ethereum/execution-apis/blob/main/src/engine/shanghai.md#specification-4 .

Co-authored-by: Martin Holst Swende <martin@swende.se>
2023-02-06 04:21:40 -05:00
Marius van der Wijden
a8cf4399a9
eth/catalyst: return invalid params instead of invalid payload params (#26591) 2023-02-02 11:52:26 +02:00
Felix Lange
df52967ff6
eth/catalyst: fix panic in TestWithdrawals (#26563)
Fixes a regression introduced in #26549
2023-01-27 15:33:28 +01:00
Marius van der Wijden
2fecac6041
eth/catalyst: implement exchangeCapabilities method (#26555)
Spec: ethereum/execution-apis#364
2023-01-27 12:03:03 +01:00
Marius van der Wijden
245cff0a1a
eth/catalyst: error on nil withdrawals post-shanghai (#26549)
This adds explicit checks for the presence of withdrawals in the engine API.

Co-authored-by: Felix Lange <fjl@twurst.com>
2023-01-27 11:42:14 +01:00
Marius van der Wijden
2a2b0419fb
all: implement withdrawals (EIP-4895) (#26484)
This change implements withdrawals as specified in EIP-4895.

Co-authored-by: lightclient@protonmail.com <lightclient@protonmail.com>
Co-authored-by: marioevz <marioevz@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
2023-01-25 15:32:25 +01:00
rjl493456442
a21e963ac2
eth/catalyst: trigger beacon sync directly with provided chain head (#26489) 2023-01-13 08:13:27 +01:00
Martin Holst Swende
b818e73ef3
tests: update tests (#26314)
This PR builds on #26299, but also updates the tests to the most recent version, which includes tests regarding TheMerge.

This change adds checks to the beacon consensus engine, making it more strict in validating the pre- and post-headers, and not relying on the caller to have already correctly sanitized the headers/blocks.
2022-12-20 09:56:52 -05:00
Martin Holst Swende
6975f09998
eth/catalyst: make tests less time-sensitive (#26201)
This makes a couple of sometimes-failing tests less brittle.
2022-11-21 09:52:12 +01:00
Martin Holst Swende
ea65edaa28
eth, catalyst: fix flaky tests (#26153)
* eth/catalyst: fix time-dependent (flaky) test

* eth: increase timeout on TestTransactionPropagation
2022-11-11 13:22:54 +01:00
Martin Holst Swende
ca948b8579
eth/catalyst, miner: deduplicate work + show payload id (#26115)
This PR now also includes a fix to the problem of mult-routines building blocks on the same input. This PR works as before with regards to stopping the work, but it just will not spin up a second routine if one is already building. So if the CL does N calls to FCU+buildblock, and N calls to GetPayload, only the first of each will do something, the other calls will be mostly no-ops.

This PR also adds printout of the payload id into the logs.
2022-11-07 15:30:54 +01:00
rjl493456442
a2a144c593
miner, eth: implement recommit mechanism for payload building (#25836)
* miner, eth: implement recommit for payload building

* miner: address comments from marius
2022-11-02 10:32:20 +01:00
rjl493456442
2c1af8b1ec
cmd, eth: implement full-sync tester (#26035)
This PR adds a parameter to startup, --synctarget. The synctarget flag is a developer-flag, that can be useful in some scenarios as a replacement for a CL node. It defines a fixed block sync target:

geth --syncmode=full --synctarget=./block_15816882.hex_rlp 

The --synctarget is only made available during syncmode=full
2022-10-28 14:48:08 +02:00
Martin Holst Swende
5a02b2d6d0
all: fix spelling mistakes (#25961) 2022-10-11 09:37:00 +02:00
Martin Holst Swende
067bac3f24
core, ethclient/gethclient: improve flaky tests (#25918)
* ethclient/gethclient: improve time-sensitive flaky test

* eth/catalyst: fix (?) flaky test

* core: stop blockchains in tests after use

* core: fix dangling blockchain instances

* core: rm whitespace

* eth/gasprice, eth/tracers, consensus/clique: stop dangling blockchains in tests

* all: address review concerns

* core: goimports

* eth/catalyst: fix another time-sensitive test

* consensus/clique: add snapshot test run function

* core: rename stop() to stopWithoutSaving()

Co-authored-by: Felix Lange <fjl@twurst.com>
2022-10-06 13:39:20 +02:00
rjl493456442
1913b50111
eth, miner: add timeout for building sealing block (#25407)
* eth, miner: add timeout for building sealing block

* eth, cmd, miner: add newpayloadtimeout flag

* eth, miner, cmd: address comments

* eth, miner: minor fixes

Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-10-03 14:10:00 +02: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
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
rjl493456442
dea1fb3cfc
all: cleanup tests (#25641)
Follow-up to PR #25523 to cleanup all relevant tests.
2022-09-07 20:21:59 +02: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
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
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
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
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
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
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
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
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
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
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