Commit Graph

4238 Commits

Author SHA1 Message Date
Kim De Mey c0199e8944
Fix startedAtMs in traceContentLookup to use system clock (#2891)
startedAtMs is the time passed since UNIX epoch in milliseconds.
Cannot use a monotime clock for that. As we want to keep mono
for other Moment.now() usage, imported epochTime from std/times
instead.
2024-11-28 19:05:15 +01:00
bhartnett e74d5c3f22
Fluffy: Reduce info logs when looking up state. (#2890) 2024-11-28 22:00:03 +08:00
bhartnett 23a43d1d15
Fluffy: Implement poke in state network (#2750)
* Implement poke in state network.
2024-11-28 20:33:57 +08:00
andri lim 5e90522e70
Bump nim-web3 to c8f36f59cb354196cfe117b6866e81d450c8cfd7 (#2878)
* Bump nim-web3 to c8f36f59cb354196cfe117b6866e81d450c8cfd7

* Fix portal bridge

* Comply to nph format style
2024-11-27 20:16:31 +07:00
andri lim e55583bf7a
Fix incomplete PR #2877 (#2880) 2024-11-27 17:45:37 +07:00
andri lim fbbc500445
Bump nim-evmc to 730d35d8572e1b3957b0c6c986ecd86413976da0 (#2879) 2024-11-27 16:08:14 +07:00
andri lim b87b255398
Add missing pieces of EIP-7702 (#2877) 2024-11-27 08:59:42 +01:00
andri lim 0926a2110b
evmstate: make batched execution possible (#2875)
* evmstate: make batched execution possible

* Revert changes in CommonRef
2024-11-27 13:15:05 +07:00
andri lim 1721435b3c
Adopt latest changes to requests hash computation (#2862)
* Adopt latest changes to requests hash computation

* Fix test vector
2024-11-27 06:09:26 +01:00
Jordan Hrycaj 0e793aedf8
For the `FC` module, never add the `base` block to base tree (#2876)
why:
  The `base` block is ancestor to all blocks of the base tree bust stays
  outside the tree.

  Some fringe condition uses an opportunistic fix when the `cursor` is not in
  the base tree, which is legit if `cursor != base`.
2024-11-26 14:00:54 +00:00
Advaita Saha f72dc00b12
Fix multiple crashes due to doassert (#2873)
* remove doassert causing mulitple crashes in nimbus

* fix tests

* introduce opt for error

* remove unused import
2024-11-26 10:31:31 +01:00
Advaita Saha 5e152f9436
Fix logging in block processing (#2870)
* log blockhash and parentHash in stateRoot mismatch

* logs for case when parent not found

* some more logs in epilogue

* add parentHash
2024-11-25 21:10:03 +01:00
andri lim daaf0f2a20
Remove trie_defs imports (#2872) 2024-11-25 16:37:57 +01:00
bhartnett 6e7e63adf5
Fluffy: Make the Kademlia concurrency factor configurable via a debug parameter (#2868) 2024-11-25 20:16:27 +08:00
andri lim fbfc1611d7
Implement EIP-7702: Set EOA account code (#2631)
* Implement EIP-7702 part 1: Behavior

* Implement EIP-7702 part 2: Tx validation

* Implement EIP-7702 part 3: Delegation Designation and Gas Costs
2024-11-25 11:28:03 +01:00
bhartnett 78c5770b2f
Fluffy State Bridge: Support skipping gossip when content is found in the network (#2867) 2024-11-25 11:40:09 +08:00
Jacek Sieka e64e5c77b3
Inline gas cost/instruction fetching (#2865)
* Inline gas cost/instruction fetching

These make up 5:ish % of EVM execution time - even though they're
trivial they end up not being inlined - this little change gives a
practically free perf boost ;)

Also unify the style of creating the output to `setLen`..

* avoid a few more unnecessary seq allocations
2024-11-24 19:41:33 +07:00
Jordan Hrycaj 81690e0446
Beacon sync fix overlapping block list import (#2866)
* Ignore `FC` overlapping blocks and the ones <= `base`

why:
  Due to concurrently running `importBlock()` by `newPayload` RPC
  requests the `FC` module layout might differ when re-visiting for
  importing blocks.

* Update logging and docu

details:
 Reduce some logging noise
 Clarify activating/suspending syncer in log messages
2024-11-22 13:23:53 +00:00
Jacek Sieka 652539e628
Simplify state root api (#2864)
`updateOk` is obsolete and always set to true - callers should not have
to care about this detail

also take the opportunity to clean up storage root naming
2024-11-22 14:15:35 +01:00
Advaita Saha ac2f3a4358
serve state in rpc (#2824)
* simpler state replay logic

* add tests
2024-11-22 16:45:52 +05:30
andri lim 7b2b59a976
Add missing fields to RPC object conversion (#2863)
* Add missing fields to RPC object conversion

* Fix populateBlockObject call

* Remove server_api_helpers.nim

* Add metric defined conditional compilation

* link with rocksdb
2024-11-22 17:07:53 +07:00
Jordan Hrycaj a241050c94
Beacon sync update multi exe heads aware (#2861)
* Log/trace cancellation events in scheduler

* Provide `clear()` functions for explicitly flushing data objects

* Renaming header cache functions

why:
  More systematic, all functions start with prefix `dbHeader`

* Remove `danglingParent` from layout

why:
  Already provided by header cache

* Remove `couplerHash` and `headHash` from layout

why:
  No need to cache, `headHash` is unused and `couplerHash` used typically
  once, only.

* Remove `lastLayout` from sync descriptor

why:
  No need to compare changes, saving is always triggered after actively
  changing the sync layout state

* Early reject unsuitable head + finalised header from CL

why:
  The finalised header is only passed by its hash so the header must be
  fetched somewhere, e.g. from a peer via eth/xx.

  Also, finalised headers earlier than the `base` from `FC` cannot be
  handled due to the `Aristo` single state database architecture.

  Luckily, on a full node, the complete block history is available so
  unsuitable finalised headers are stored there already which is exploited
  here to avoid unnecessary network traffic.

* Code cosmetics, remove cruft, prettify logging, remove `final` metrics

detail:
  The `final` layout parameter will be deprecated and later removed

* Update/re-calibrate syncer logic documentation

why:
  The current implementation sucks if the `FC` module changes the
  canonical branch in the middle of completing a header chain (due
  to concurrent updates by the `newPayload()` logic.)

* Implement according to re-calibrated syncer docu

details:
  The implementation employs the notion of named layout states (see
  `SyncLayoutState` in `worker_desc.nim`) which are derived from the
  state parameter triple `(C,D,H)` as described in `README.md`.
2024-11-21 16:32:47 +00:00
andri lim c525590a51
Fix simulator RPC object: add fields from latest spec (#2859) 2024-11-21 21:58:12 +07:00
andri lim a57a887269
Fix t8n regression: Legacy Tx should not validate chainId (#2858) 2024-11-21 21:57:22 +07:00
Kim De Mey 453cb2f33e
portal_bridge: Add concurrency to the history content gossip (#2855) 2024-11-21 15:30:42 +01:00
Kim De Mey 107db3ae16
fluffy: revert iplimit/bitperhop debug flags (#2860)
Revert for now to their previous names to avoid fluffy fleet
breakage.
2024-11-21 13:36:18 +01:00
bhartnett 4b63cdeaac
Remove direct local content lookup from PortalRpcClient. (#2857) 2024-11-21 20:20:09 +08:00
bhartnett 508ce79cdd
Fluffy: Log nodeId when receiving offers (#2856)
* Log nodeId when receiving offers.
2024-11-21 20:17:38 +08:00
Kim De Mey b671499fdc
fluffy: Make concurrent offers configurable at cli (#2854) 2024-11-21 04:05:33 +07:00
Jacek Sieka 6086c2903c
Small deserialization speedup (#2852)
When walking AriVtx, parsing integers and nibbles actually becomes a
hotspot - these trivial changes reduces CPU usage during initial key
cache computation by ~15%.
2024-11-20 16:04:32 +01:00
Kim De Mey 3ea5c531d1
portal_bridge history: fully support gossip of block by number (#2853)
+ some minor cleanup & reuse of code
2024-11-20 14:07:36 +01:00
Jacek Sieka 01ca415721
Store keys together with node data (#2849)
Currently, computed hash keys are stored in a separate column family
with respect to the MPT data they're generated from - this has several
disadvantages:

* A lot of space is wasted because the lookup key (`RootedVertexID`) is
repeated in both tables - this is 30% of the `AriKey` content!
* rocksdb must maintain in-memory bloom filters and LRU caches for said
keys, doubling its "minimal efficient cache size"
* An extra disk traversal must be made to check for existence of cached
hash key
* Doubles the amount of files on disk due to each column family being
its own set of files

Here, the two CFs are joined such that both key and data is stored in
`AriVtx`. This means:

* we save ~30% disk space on repeated lookup keys
* we save ~2gb of memory overhead that can be used to cache data instead
of indices
* we can skip storing hash keys for MPT leaf nodes - these are trivial
to compute and waste a lot of space - previously they had to present in
the `AriKey` CF to avoid having to look in two tables on the happy path.
* There is a small increase in write amplification because when a hash
value is updated for a branch node, we must write both key and branch
data - previously we would write only the key
* There's a small shift in CPU usage - instead of performing lookups in
the database, hashes for leaf nodes are (re)-computed on the fly
* We can return to slightly smaller on-disk SST files since there's
fewer of them, which should reduce disk traffic a bit

Internally, there are also other advantages:

* when clearing keys, we no longer have to store a zero hash in memory -
instead, we deduce staleness of the cached key from the presence of an
updated VertexRef - this saves ~1gb of mem overhead during import
* hash key cache becomes dedicated to branch keys since leaf keys are no
longer stored in memory, reducing churn
* key computation is a lot faster thanks to the skipped second disk
traversal - a key computation for mainnet can be completed in 11 hours
instead of ~2 days (!) thanks to better cache usage and less read
amplification - with additional improvements to the on-disk format, we
can probably get rid of the initial full traversal method of seeding the
key cache on first start after import

All in all, this PR reduces the size of a mainnet database from 160gb to
110gb and the peak memory footprint during import by ~1-2gb.
2024-11-20 09:56:27 +01:00
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