2067 Commits

Author SHA1 Message Date
Jordan Hrycaj
184af027dc
Beacon sync metrics managemnt update (#3016)
* Sync scheduler provides an independent `ticker` loop process

why:
  Can be used to update `metrics` and for debug logging. While an event
  driven solution would stall if there are no events at the moment (e.g.
  when the syncer hibernates, the `ticker` will run regardless.

* Use `runTicker()` loop interface alike for updating ticker

why:
  Not event driven anymore so it will not stall when the syncer
  hibernates.

* Re-implement logging ticker by running it within the `runTicker()` driver

why:
  Simplifies implementation

* Re-name metrics variable to better fit into the current naming schemes

* Fix copyright header
2025-01-22 10:12:50 +00:00
andri lim
c62024ea24
devnet-5: Add EIP-7623: Increase calldata cost (#3015)
* devnet5: Add EIP-7623: Increase calldata cost

* Fix copyright year
2025-01-21 11:26:23 +00:00
Jordan Hrycaj
3aae33d6cc
Beacon sync maintenance update (#3012)
* Force metrics update when peers vanish

why:
  After that there might be reduced activity so that the next metrics
  update is delayed.

* Update comments (code cosmetics)

* Tidy up nano-sleep wait directives to an `update.nim`-function

* Fix copyright year
2025-01-20 10:30:04 +00:00
Advaita Saha
bf57c8e0e4
fix copyright lint failure (#3008) 2025-01-17 16:29:26 +05:30
andri lim
aa85d6a61c
Only hashing immutable part of network configuration for dataDir ID (#2955)
* Only hashing immutable part of network configuration for dataDir ID

* Add debug- prefix to rewrite-datadir-id
2025-01-17 15:33:15 +05:30
andri lim
ac053bf4c8
devnet-5: Add EIP-7840: Add blob schedule to EL config files (#3005)
* devnet-5: Add EIP-7840: Add blob schedule to EL config files

* Fix test_transaction_json

* Add missing blobSchedule to common/helpers
2025-01-16 05:10:52 +00:00
andri lim
232a9ad247
devnet-5: Update EIP-7702: Remove delegation behavior of EXTCODE* (#2871) 2025-01-15 14:30:26 +00:00
andri lim
5c02b88f82
devnet-5: Update EIP-2935: bring up to date with sys contract impl (#3003)
* devnet-5: Update EIP-2935: bring up to date with sys contract impl

* Fix copyright year
2025-01-15 02:42:20 +00:00
andri lim
265d794583
devnet-5: Move EIP-7702 Authorization validation to authority func (#2999)
* Move EIP-7702 Authorization validation to authority func

If the authorization is invalid the transaction itself is still valid,
the invalid authorization will be skipped.

* Fix copyright year
2025-01-15 02:18:25 +00:00
andri lim
288ee28077
Integrate PoS payload attributes into txPool (#2998)
* Integrate PoS payload attributes into txPool

* Fix test_txpool
2025-01-14 13:30:56 +00:00
Advaita Saha
23fa3b8e1e
Logging Fixes for INFO and DEBUG level (#2984)
* logs summarized

* fix copyright year

* add topics for logs

* fix copyright year

* bring syncer logs to info & debug level

* fix debug dockerfile

* fix: copyright error

* shift txpool logs to debug and introduce logs in rpc

* after header bring block download to info level

* comments for finalization summary of logs

* change literals to meaningful names

* remove unwanted data from userfacing logs

* include target logs

* remove control

* fix capitalization

* complete txpool
2025-01-09 12:33:29 +05:30
andri lim
0ffc17d153
Merge test_txpool and test_txpool2 (#2983)
* Merge test_txpool and test_txpool2

* Fix copyright year
2025-01-05 08:05:29 +00:00
andri lim
7c0c507f6a
TxPool: simplify byPriceAndNonce algorithm (#2978)
Remove the intermediate bySender table usage. This will lower
the memory and CPU usage.

Also add more comments about how algorithm works.
2024-12-29 13:02:42 +07:00
andri lim
7d3616e3d9
Refactor TxPool: leaner and simpler (#2973)
* Refactor TxPool: leaner and simpler
* Rewrite test_txpool

Reduce number of tables used, from 5 to 2. Reduce number of files.
If need to modify the price rule or other filters, now is far more easier because only one table to work with(sender/nonce).
And the other table is just a map from txHash to TxItemRef.

Removing transactions from txPool either because of producing new block or syncing became much easier.
Removing expired transactions also simple.
Explicit Tx Pending, Staged, or Packed status is removed. The status of the transactions can be inferred implicitly.
Developer new to TxPool can easily follow the logic.

But the most important is we can revive the test_txpool without dirty trick and remove usage of getCanonicalHead furthermore to prepare for better integration with ForkedChain.
2024-12-26 17:07:25 +07:00
andri lim
487743fc2e
Proper setup of test_rpc (#2969)
Instead of using ancient/dirty code to setup the rpc test, now using newest method from TxPool and ForkedChain.
Also fix some bugs in server_api discovered when using this new setup.
2024-12-22 16:18:46 +07:00
andri lim
aba9b582db
Rename stateDB to ledger (#2966)
* Rename stateDB to ledger

* Fix readOnlyLedger
2024-12-21 20:46:13 +07:00
andri lim
473da69043
Remove unused stuff from txpool (#2967) 2024-12-21 20:13:33 +07:00
andri lim
86fc24a1d7
devnet-5: Update EIP-7685: exclude empty requests data in commitment (#2963)
* devnet-5: Update EIP-7685: exclude empty requests data in commitment

* Fix test vector

* Add more tests

* Fix executionRequests order validation

* Simplify test vector

* Fix t8n executionRequests output
2024-12-21 05:59:30 +00:00
Jacek Sieka
036dd23e9b
cleanups, import fixes (#2964)
* more generic-path removal
* tighter imports
2024-12-20 12:57:15 +01:00
andri lim
80f8b3c2b1
devnet-5: Implement EIP-7691: Blob throughput increase (#2957) 2024-12-20 09:12:16 +00:00
andri lim
1dff892995
devnet-5: Update EIP-2537: Remove redundant MUL precompiles (#2962) 2024-12-20 05:29:30 +00:00
andri lim
6085457f9b
devnet-5: Update EIP-2537: Gas repricing (#2959) 2024-12-19 17:38:29 +00:00
Jordan Hrycaj
c801a11190
Beacon sync mainentenance updates (#2958)
* Fix name after API change

why:
  Slipped through (debugging mode)

* Fine tuning error counters

why:
  Previous operating mode was quite blunt and considered some unnecessary
  condition. Error handling was invoked and the peer zombified where one
  could have continued working with that peer.

* Provide `kvt` table API bypassing `FC`

details:
  Not a full bypass yet

why:
  As discussed on Discord:
    Ideally, those would pass through fc as well, as thin wrappers around
    the db calls, for now - later, we probably see some policy involved
    here and at that point, fc will be responsible for arbitrage between
    sources (ie if a rpc source sends the block the syncer is syncing
    while the syncer is working, fc is there to referee


* Apply `kvt` API from `FC` to beacon sync

* No need to use extra table for persistent header cache state record

why:
  Slot zero can do. This allows deleting that table wholesale when needed
  once thatfeature is available.

* Logger updates

details:
  + Lifting main header/block op logs from `trace` to `debug`
  + Set metrics update before nano-sleep (for task switch)
2024-12-19 12:02:36 +00:00
andri lim
55fd25758a
devnet-5: fix Consolidation and Withdrawal request predeploy address (#2956)
* devnet-5: fix Consolidation and Withdrawal request predeploy address

[Update EIP-7251: Set MAX_CONSOLIDATIONS=2](https://github.com/ethereum/EIPs/pull/9127)
will override
[Update EIP-7251: fix CONSOLIDATION_REQUEST_PREDEPLOY_ADDRES](https://github.com/ethereum/EIPs/pull/9118)
therefore we only need the later.

* Fix test vectors
2024-12-19 10:39:18 +00:00
Advaita Saha
48aa410f8a
reduce blockHash call (#2954) 2024-12-19 01:13:12 +05:30
andri lim
cd3cea0e29
Fix bn256ecPairing precompile bug (#2953)
Thanks to @holiman of goevmlab for his fuzzer.
Similar with Blake2b precompile regression #2919.
When error, the precompile should not return any output.
2024-12-18 23:04:14 +07:00
Jacek Sieka
d45d03ce0c
reduce tx naming overload (#2952)
* if it's a db function, use `txFrame...`
* if it's not a db function, don't use `txFrame...`
2024-12-18 23:03:51 +07:00
Jacek Sieka
7bbb0f4421
Stream blocks during import (#2937)
When running the import, currently blocks are loaded in batches into a
`seq` then passed to the importer as such.

In reality, blocks are still processed one by one, so the batching does
not offer any performance advantage. It does however require that the
client wastes memory, up to several GB, on the block sequence while
they're waiting to be processed.

This PR introduces a persister that accepts these potentially large
blocks one by one and at the same time removes a number of redundant /
unnecessary copies, assignments and resets that were slowing down the
import process in general.
2024-12-18 13:21:20 +01:00
Jacek Sieka
06a544ac85
Remove forkTx and friends (#2951)
The forking facility has been replaced by ForkedChain - frames and
layers are two other mechanisms that mostly do the same thing at the
aristo level, without quite providing the functionality FC needs - this
cleanup will make that integration easier.
2024-12-18 11:56:46 +01:00
andri lim
45bc6422a0
Reduce getCanonicalHead usage, and delegate to ForkedChain (#2948)
The current getCanonicalHead of core db should not be confused with ForkedChain.latestHeader.
Therefore we need to use getCanonicalHead to restricted case only, e.g. initializing ForkedChain.
2024-12-18 11:04:23 +07:00
andri lim
b8932d9519
Remove MergeForkBlock alias and use MergeNetSplitBlock only (#2947) 2024-12-17 11:42:13 +00:00
andri lim
f8a6ed4f5f
Replace deprecated toBytes with toBytesBE in bn256ecPairing precompile (#2944) 2024-12-17 18:17:47 +07:00
andri lim
f74813520a
Connect gasLimit from Config to CommonRef (#2946) 2024-12-17 10:48:31 +00:00
tersec
0b704040e3
increase default gas limit from 30M to 36M (#2941) 2024-12-16 23:32:29 +00:00
Jordan Hrycaj
0ce5234231
Beacon sync mitigate deadlock with bogus sticky peers (#2943)
* Metrics cosmetics

* Better naming for error threshold constants

* Treating header/body process error different from response errors

why:
  Error handling becomes active not until some consecutive failures
  appear. As both types of errors may interleave (i.g. no response
  errors) the counter reset for one type might affect the other.

  By doing it wrong, a peer might send repeatedly a bogus block so
  locking in the syncer in an endless loop.
2024-12-16 16:26:38 +00:00
andri lim
650fec5a26
Wire ForkedChainRef to graphql and rpc_utils (#2936)
* fixes

* Wire ForkedChainRef to graphql and rpc_utils
2024-12-13 14:34:32 +07:00
andri lim
a57958f71e
Remove totalTerminalDifficultyPassed (#2934) 2024-12-13 13:29:00 +07:00
andri lim
2e5ef4fb5a
Wire ForkedChainRef properly to TxPool (#2933) 2024-12-13 13:21:20 +07:00
andri lim
847cc311eb
Remove verifyFrom, vmState, and checkSeal from ChainRef (#2932) 2024-12-13 12:12:57 +07:00
Jacek Sieka
3d58393b4c
Offload signature checking to taskpools (#2927)
In block processing, depending on the complexity of a transaction and
hotness of caches etc, signature checking can actually make up the
majority of time needed to process a transaction (60% observed in some
randomly sampled block ranges).

Fortunately, this is a task that trivially can be offloaded to a task
pool similar to how nimbus-eth2 does it.

This PR introduces taskpools in the most simple way possible, by
performing signature checking concurrently with other TX processing,
assigning a taskpool task per TX effectively.

With this little trick, we're in gigagas land 🎉 on my laptop!

```
INF 2024-12-10 21:05:35.170+01:00 Imported blocks
blockNumber=3874817 b... mgps=1222.707 ...
```

Tests don't use the taskpool for now because it needs manual cleanup and
we don't have a good mechanism in place. Future PR:s should address this
by creating a common shutdown sequence that also closes and cleans up
other resources like the DB.

Co-authored-by: andri lim <jangko128@gmail.com>
2024-12-13 11:53:41 +07:00
andri lim
1d5a48e153
Feature: configurable gas limit when building execution payload (#2931)
* Feature: configurable gas limit when building execution payload

* Raise default gas limit to 30M
2024-12-13 10:47:35 +07:00
Jordan Hrycaj
cbc5ec9385
Beacon sync logging updates (#2930)
* Cosmetics, add some metrics updates to smoothen curves

why:
  Progress downloading blocks was just a jump from none to full

* Reclassifying some syncer gossip from TRC to DBG

why:
  Might help debugging without full trace logs
2024-12-12 17:35:10 +00:00
andri lim
674e65f359
Move EVM code initialization outside of newComputation (#2926)
* Move EVM code initialization outside of newComputation

* Tidying up call_common.setupHost
2024-12-11 14:56:41 +01:00
Jacek Sieka
7b88bb3b30
Add branch cache (#2923)
Now that branches are small, we can add a branch cache that fits more
verticies in memory by only storing the branch portion (16 bytes) of the
VertexRef (136 bytes).

Where the original vertex cache hovers around a hit rate of ~60:ish,
this branch cache reaches >90% hit rate instead around block 20M which
gives a nice boost to processing.

A downside of this approach is that a new VertexRef must be allocated
for every cache hit instead of reusing an existing instance - this
causes some GC overhead that needs to be addressed.

Nice 15% improvement nonetheless, can't complain!

```
blocks: 19630784, baseline: 161h18m38s, contender: 136h23m23s
Time (total): -24h55m14s, -15.45%
```
2024-12-11 11:53:26 +01:00
andri lim
57157a6f76
Fix Blake2b precompile regression (#2919)
Introduced by #2865
Detected on Holesky block 2.406.802 tx no 11
And on MainNet block 19.633.393
2024-12-09 20:52:34 +01:00
Jacek Sieka
a056a722eb
Sort subkey lookups by VertexID when computing keys (#2918)
Since data is ordered by VertexID on disk, with this simple trick we can
make much better use of the various rocksdb caches.

Computing the state root of the full mainnet state is down to 4 hours
(from 9) on my laptop.
2024-12-09 08:16:02 +01:00
Jacek Sieka
66ad5497d9
Unroll nibble ops (#2894)
A bit unexpectedly, nibble handling shows up in the profiler mainly
because the current impl is tuned towards slicing while the most common
operation is prefix comparison - since the code is simple, might has
well get rid of some of the excess fat by always aliging the nibbles to
the byte buffer.
2024-12-09 08:15:04 +01:00
Jordan Hrycaj
9a9d391217
Fix race condition on syncer termination (#2916)
* Cosmetics

* Must not async wait inside termination `for` loop

why:
  Async-waiting inside a `for` loop will switch to temination process
  which uncontrollably will modify the for-loop data base.

* Avoid `waitFor` in scheduler termination code

why:
  Is reserved for main loop
2024-12-06 12:11:40 +00:00
Jacek Sieka
667897557a
Interpreter dispatch cleanups (#2913)
* `shouldPrepareTracer` always true
* simple `pop` should not copy value (reading the memory shows up in a
profiler)
* continuation code simplified
* remove some unnecessary EH
2024-12-06 13:01:15 +01:00
andri lim
9b7e2960c2
Add Holesky deposit contract address (#2915) 2024-12-06 10:06:52 +00:00