Commit Graph

4206 Commits

Author SHA1 Message Date
Kim De Mey d496793fa6
fluffy/portal: Add missing imports (#2851)
Would/could fail compilation when using portal_node as module,
depending on import order.
2024-11-19 15:38:10 +01:00
Kim De Mey 32b5b8a173
Fluffy guide: fix formatting for development status docs (#2850) 2024-11-18 10:30:23 +01:00
Jacek Sieka 9e98c934b7
eth: bump to devp2p v5 (#2837) 2024-11-08 10:24:35 +01:00
andri lim 666f8d2cf1
Fixes related to Prague execution requests (#2847)
* Fixes related to Prague execution requests

Turn out the specs are changed:
- WITHDRAWAL_REQUEST_ADDRESS -> WITHDRAWAL_QUEUE_ADDRESS
- CONSOLIDATION_REQUEST_ADDRESS -> CONSOLIDATION_QUEUE_ADDRESS
- DEPOSIT_CONTRACT_ADDRESS -> only mainnet
- depositContractAddress can be configurable

Also fix bugs related to t8n tool

* Fix for evmc
2024-11-08 10:47:07 +07:00
andri lim c15647075d
Use CompileDate's year part for copyright banner (#2848)
* Use CompileDate's year part for copyright banner

* Fix copyright year

* Fix missing import
2024-11-08 10:46:37 +07:00
Kim De Mey d643556d4b
fluffy.guide: Update development status (#2846) 2024-11-07 17:17:40 +01:00
bhartnett 9dceb58ad0
Fluffy: Prioritize nodes that have radius in range of target content in lookup (#2841)
* Prioritize nodes that have radius in range of target content in content lookup.
2024-11-07 16:59:59 +08:00
andri lim 70a1f768f7
Engine API: Route more wiring from CoreDb to ForkedChain (#2844) 2024-11-07 03:43:25 +00:00
andri lim 6b86acfb8d
Cleanup db/core_apps error handling (#2838)
* Cleanup db/core_apps error handling

* Fix persistHeader

* Fix getUncles
2024-11-07 08:24:21 +07:00
Kim De Mey eaf98dccb1
Change some spammy info/error logs to debug (#2840)
These logs are not really usful to an end user, and are rather
for developers, so we move them to debug.
2024-11-06 15:44:20 +01:00
andri lim fcb668d23f
FC fix: Genesis hash should canonical too (#2839)
* FC fix: Genesis hash should canonical too

* Remove debugEcho from production code
2024-11-06 12:38:35 +00:00
Kim De Mey cff7091826
Fix flaky portal tests - part II (#2829)
* Remove two simple sleeps from history network test

Replace simple sleeps in test_history_network with retries +
sleeps. Current simple sleep setting would occasionally still
fail on CI.

* Increase retries on test_portal_testnet from 2 to 3.

* Add 1 second sleep after headers with proof get gossiped
2024-11-06 11:10:31 +01:00
Kim De Mey 6374bfb39c
Refactor/clean-up/prepping history network code (#2836)
- Move any validation related code to new file
- Move any type conversion related code to new file
- Prepare validation code for adding different type of canonical
proofs
- Prepare for validation code for json-rpc api
- several other clean-ups and renames

Sort of a first pass as the validation code specifically can
use some further changes.
2024-11-06 08:49:55 +01:00
Jacek Sieka 39e6b63138
eth: bump for rlpx transport fixes (#2830)
* eth: bump for rlpx transport fixes

* bump
2024-11-06 09:02:15 +07:00
andri lim f201eb611e
Simplify LedgerRef: remove unnecessary abstraction (#2826) 2024-11-06 09:01:56 +07:00
andri lim 6c3bbbf22c
Feature: Prevent loading an existing data directory for the wrong network (#2825)
* Prevent loading an existing data directory for the wrong network

* Fix and add more info
2024-11-06 09:01:42 +07:00
andri lim f0f607b23b
Feature: User configurable extraData when assemble a block (#2823)
* Feature: User configurable extraData when assemble a block

As evident from https://holesky.beaconcha.in/block/2657016
when nimbus-eth1 assemble a block, the extraData field is empty.
This commit will give user a chance to put his extraData or
use default value.

* Warning if extraData exceeds 32 bytes limit

* Add missing comma
2024-11-06 09:01:25 +07:00
Jordan Hrycaj 7fe4023d1f
Beacon sync docu todo and async prototype update v2 (#2832)
* Annotate `async` functions for non-exception tracking at compile time

details:
  This also requires some additional try/except catching in the function
  bodies.

* Update sync logic docu to what is to be updated

why:
  The understanding of details of how to accommodate for merging
  sub-chains of blocks or headers have changed. Some previous set-ups
  are outright wrong.
2024-11-05 11:39:45 +00:00
Kim De Mey 226d084e90
Fix flaky test_portal_testnet CI test with retries (#2808)
* Add two, not so great, quick fix attempts for flaky CI

* Another attempt

* Remove the increased sleep in test_history_network

Need something better here.
2024-11-04 18:02:56 +01:00
Kim De Mey 73b228fb1d
Remove EpochRecord getContent (#2828)
EpochRecord type is removed from the network.

And avoid a deprecation warning in portal_bridge.
2024-11-04 16:53:37 +01:00
bhartnett 22653c83dd
Fluffy: Implement contains db handler to improve lookup performance when accepting offers (#2815)
* Remove getSszDecoded from ContentDb.

* Update ContentDb get to use onData callback to reduce copies.

* Use templates for helper procs in ContentDb.

* Add contains handler to portal protocol.

* Improve performance of DbGetHandler.
2024-11-04 22:02:51 +08:00
andri lim 89fac051cd
Reduce declared but not used warnings (#2822) 2024-11-03 00:11:24 +00:00
andri lim 4ffe056a25
Engine API simulator: simplify versioned method call (#2821)
* Engine API simulator: simplify versioned method call

* More cleanup
2024-11-02 16:58:18 +07:00
Advaita Saha a45ac7e327
Port p2p to server API (#2769)
* eth_gasPrice

* signing endpoints

* transaction by hash + temp fixes

* fix CI

* fix: state not persisted

* decouple state access changes from this PR

* rpc complete set

* tests modified

* tests temp modifications

* add tests to CI + minor fixes

* remove p2p

* remove old dependency

* fix suggestions

* rework tests

* rework kurtosis issue + comments

* fix post bump issues

* suggestions + logs

* remove unused imports
2024-11-02 10:30:45 +01:00
Jacek Sieka 58cde36656
Remove `RawData` from possible leaf payload types (#2794)
This kind of data is not used except in tests where it is used only to
create databases that don't match actual usage of aristo.

Removing simplifies future optimizations that can focus on processing
specific leaf types more efficiently.

A casualty of this removal is some test code as well as some proof
generation code that is unused - on the surface, it looks like it should
be possible to port both of these to the more specific data types -
doing so would ensure that a database written by one part of the
codebase can interact with the other - as it stands, there is confusion
on this point since using the proof generation code will result in a
database of a shape that is incompatible with the rest of eth1.
2024-11-02 10:29:16 +01:00
Jacek Sieka a5541a5a4f
holesky: fix timestamp (#2819)
* holesky: fix timestamp

* log a bit more about genesis
2024-11-02 08:18:26 +01:00
andri lim c88c1911c9
Simplify BeaconEngineRef (#2812) 2024-11-02 08:45:27 +07:00
Jordan Hrycaj 430611d3bc
Beacon sync updates tbc (#2818)
* Clear rejected sync target so that it would not be processed again

* Use in-memory table to stash headers after FCU import has started

why:
  After block imported has started, there is no way to save/stash block
  headers persistently. The FCU handlers always maintain a positive
  transaction level and in some instances the current transaction is
  flushed and re-opened.

  This patch fixes an exception thrown when a block header has gone
  missing.

* When resuming sync, delete stale headers and state

why:
  Deleting headers saves some persistent space that would get lost
  otherwise. Deleting the state after resuming prevents from race
  conditions.

* On clean start hibernate sync `deamon` entity before first update from CL

details:
  Only reduces services are running
  * accept FCU from CL
  * fetch finalised header after accepting FCY (provides hash only)

* Improve text/meaning of some log messages

* Revisit error handling for useless peers

why:
  A peer is abandoned from if the error score is too high. This was not
  properly handled for some fringe case when the error was detected at
  staging time but fetching via eth/xx was ok.

* Clarify `break` meaning by using labelled `break` statements

* Fix action how to commit when sync target has been reached

why:
  The sync target block number might precede than latest FCU block number.
  This happens when the engine API squeezes in some request to execute
  and import subsequent blocks.

  This patch fixes and assert thrown when after reaching target the latest
  FCU block number is higher than the expected target block number.

* Update TODO list
2024-11-01 19:18:41 +00:00
tersec 73661fd8a4
switch to Nim v2.0.12 (#2817)
* switch to Nim v2.0.12

* fix LruCache capitalization for styleCheck

* KzgProof/KzgCommitment for styleCheck

* TxEip4844 for styleCheck

* styleCheck issues in nimbus/beacon/payload_conv.nim

* ENode for styleCheck

* isOk for styleCheck

* some more styleCheck fixes

* more styleCheck fixes

---------

Co-authored-by: jangko <jangko128@gmail.com>
2024-11-01 19:06:26 +00:00
Jacek Sieka 20edc0dcf5
Use common format for clientid (#2810) 2024-11-01 21:29:38 +07:00
Kim De Mey 8be105ceaa
Default enable Portal beacon subnetwork (#2806) 2024-10-30 23:26:49 +01:00
Kim De Mey bef4c05561
Add custom json-rpc method to initialize the trusted block root (#2805) 2024-10-30 18:32:36 +01:00
bhartnett 8d8f62bf67
Fluffy: Improve logging and add offer metrics to status logs. (#2802)
* Set offer processing logs to debug level and add offer counts to state network.

* Use metrics instead of int counters and remove from logs.

* More logging improvements. Make decoding and validation failures use error log level.

* Add protocol_id to metrics.
2024-10-30 21:17:16 +08:00
Kim De Mey e038a383c1
Add pruning of bootstraps/updates in Portal beacon network (#2779) 2024-10-30 12:51:00 +01:00
andri lim 94198bcf95
Fix engine api simulator related to eth types refactoring (#2801) 2024-10-29 22:06:52 +07:00
Jacek Sieka 26149e0679
introduce `nimbus_execution_client` makefile target (#2800)
`nimbus` is kept for backwards comnpatiblity for now but may soon change
meaning
2024-10-29 13:37:23 +00:00
andri lim d2d6d865cb
Build rocksdb on linux and macos in simulator CI (#2798) 2024-10-29 14:16:14 +07:00
andri lim fa95633b57
Fix calcRequestsHash implementation (#2797)
Turn out it is a double layer hash
2024-10-29 05:01:59 +00:00
tersec 11c875c5c2
rm --protocol CLI flag (#2793) 2024-10-28 22:17:07 +00:00
Jacek Sieka 1406feab5f
fix computeKey account hash (#2795)
Oops. Discovered as part of making the code use the actual production
database types in the key computation test ;)
2024-10-28 19:14:28 +01:00
Jacek Sieka 43e08d08c7
drop support for generic data in coredb (#2792)
All actual access to CoreDB is typed (account or storage) - it's
unlikely ethereum will grow another trie structure in the near future.
2024-10-28 17:56:43 +01:00
Jordan Hrycaj ea268e81ff
Beacon sync activation control update (#2782)
* Clarifying/commenting FCU setup condition & small fixes, comments etc.

* Update some logging

* Reorg metrics updater and activation

* Better `async` responsiveness

why:
  Block import does not allow `async` task activation while
  executing. So allow potential switch after each imported
  block (rather than a group of 32 blocks.)

* Handle resuming after previous sync followed by import

why:
  In this case the ledger state is more recent than the saved
  sync state. So this is considered a pristine sync where any
  previous sync state is forgotten.

  This fixes some assert thrown because of inconsistent internal
  state at some point.

* Provide option for clearing saved beacon sync state before starting syncer

why:
  It would resume with the last state otherwise which might be undesired
  sometimes.

  Without RPC available, the syncer typically stops and terminates with
  the canonical head larger than the base/finalised head. The latter one
  will be saved as database/ledger state and the canonical head as syncer
  target. Resuming syncing here will repeat itself.

  So clearing the syncer state can prevent from starting the syncer
  unnecessarily avoiding useless actions.

* Allow workers to request syncer shutdown from within

why:
  In one-trick-pony mode (after resuming without RPC support) the
  syncer can be stopped from within soavoiding unnecessary polling.
  In that case, the syncer can (theoretically) be restarted externally
  with `startSync()`.

* Terminate beacon sync after a single run target is reached

why:
  Stops doing useless polling (typically when there is no RPC available)

* Remove crufty comments

* Tighten state reload condition when resuming

why:
  Some pathological case might apply if the syncer is stopped while the
  distance between finalised block and head is very large and the FCU
  base becomes larger than the locked finalised state.

* Verify that finalised number from CL is at least FCU base number

why:
  The FCU base number is determined by the database, non zero if
  manually imported. The finalised number is passed via RPC by the CL
  node and will increase over time. Unless fully synced, this number
  will be pretty low.

  On the other hand, the FCU call `forkChoice()` will eventually fail
  if the `finalizedHash` argument refers to something outside the
  internal chain starting at the FCU base block.

* Remove support for completing interrupted sync without RPC support

why:
  Simplifies start/stop logic

* Rmove unused import
2024-10-28 16:22:04 +00:00
Advaita Saha ba1cbed14f
better logging for running client (#2781)
* better logging for running client

* logs for persistance + more data

* persistance logs fixed

* blobgas

* blobGas is Opt

* suggestions added

* fcU fixed
2024-10-27 22:20:04 +00:00
Jacek Sieka d828dead2d
Use stateRoot/storageRoot more consistently (#2791)
* prefer the spec-derived name where possible
* don't pass stateRoot to LedgerRef and friends (it doesn't do anything)
* add deprecation warning in graphql - it needs updating to use
forkedchain instead
2024-10-27 19:56:28 +01:00
Kim De Mey 6307ea30aa
Update portal-spec-tests to latest revision (#2790) 2024-10-27 19:03:05 +01:00
Advaita Saha 814c2e1536
`external_sync` rename to `sync` (#2789)
* rename to sync

* improve logging and epoch only fcu call

* suggestions added

* static check
2024-10-27 13:23:32 +00:00
Jacek Sieka 188d689d9d
Speed up initial MPT root computation after import (#2788)
When `nimbus import` runs, we end up with a database without MPT roots
leading to long startup times the first time one is needed.

Computing the state root is slow because the on-disk order based on
VertexID sorting does not match the trie traversal order and therefore
makes lookups inefficent.

Here we introduce a helper that speeds up this computation by traversing
the trie in on-disk order and computing the trie hashes bottom up
instead - even though this leads to some redundant reads of nodes that
we cannot yet compute, it's still a net win as leaves and "bottom"
branches make up the majority of the database.

This PR also addresses a few other sources of inefficiency largely due
to the separation of AriKey and AriVtx into their own column families.

Each column family is its own LSM tree that produces hundreds of SST
filtes - with a limit of 512 open files, rocksdb must keep closing and
opening files which leads to expensive metadata reads during random
access.

When rocksdb makes a lookup, it has to read several layers of files for
each lookup. Ribbon filters to skip over files that don't have the
requested data but when these filters are not in memory, reading them is
slow - this happens in two cases: when opening a file and when the
filter has been evicted from the LRU cache. Addressing the open file
limit solves one source of inefficiency, but we must also increase the
block cache size to deal with this problem.

* rocksdb.max_open_files increased to 2048
* per-file size limits increased so that fewer files are created
* WAL size increased to avoid partial flushes which lead to small files
* rocksdb block cache increased

All these increases of course lead to increased memory usage, but at
least performance is acceptable - in the future, we'll need to explore
options such as joining AriVtx and AriKey and/or reducing the row count
(by grouping branch layers under a single vertexid).

With this PR, the mainnet state root can be computed in ~8 hours (down
from 2-3 days) - not great, but still better.

Further, we write all keys to the database, also those that are less
than 32 bytes - because the mpt path is part of the input, it is very
rare that we actually hit a key like this (about 200k such entries on
mainnet), so the code complexity is not worth the benefit really, in the
current database layout / design.
2024-10-27 11:08:37 +00:00
Kim De Mey 85d8ed7be1
Adjust ForkDigest dynamically in Portal beacon content tests (#2778)
Also iterates over multiple dirs now to run tests for each fork.
2024-10-27 08:34:50 +01:00
andri lim 738cb277cf
Fixes related to executionRequests of Pectra (#2787) 2024-10-26 11:10:54 +00:00
Jacek Sieka 6b2d341ebb
simplify genesis generation code (#2786)
* remove redundant abstraction
* fix misleading raises - the implementation actually swallows errors or
panics (depending on how many other layers of abstraction we penetrate
before detecting it)
2024-10-26 16:26:38 +07:00