Commit Graph

17 Commits

Author SHA1 Message Date
Jacek Sieka 768307d91d
Cache code and invalid jump destination tables (fixes #2268) (#2404)
It is common for many accounts to share the same code - at the database
level, code is stored by hash meaning only one copy exists per unique
program but when loaded in memory, a copy is made for each account.

Further, every time we execute the code, it must be scanned for invalid
jump destinations which slows down EVM exeuction.

Finally, the extcodesize call causes code to be loaded even if only the
size is needed.

This PR improves on all these points by introducing a shared
CodeBytesRef type whose code section is immutable and that can be shared
between accounts. Further, a dedicated `len` API call is added so that
the EXTCODESIZE opcode can operate without polluting the GC and code
cache, for cases where only the size is requested - rocksdb will in this
case cache the code itself in the row cache meaning that lookup of the
code itself remains fast when length is asked for first.

With 16k code entries, there's a 90% hit rate which goes up to 99%
during the 2.3M attack - the cache significantly lowers memory
consumption and execution time not only during this event but across the
board.
2024-06-21 09:44:10 +02:00
andri lim 5a18537450
Bump nim-eth, nim-web3, nimbus-eth2 (#2344)
* Bump nim-eth, nim-web3, nimbus-eth2

- Replace std.Option with results.Opt
- Fields name changes

* More fixes

* Fix Portal stream async raises and portal testnet Opt usage

* Bump eth + nimbus-eth2 + more fixes related to eth_types changes

* Fix in utp test app and nimbus-eth2 bump

* Fix test_blockchain_json rebase conflict

* Fix EVMC block_timestamp conversion plus commentary

---------

Co-authored-by: kdeme <kim.demey@gmail.com>
2024-06-14 14:31:08 +07:00
Kim De Mey 7b2dc8f8e9
Fix ReceiptType in premix + Apply validate flag for receipts (#2012) 2024-02-08 11:50:35 +01:00
jangko 3e21281d12
Bump nim-web3 and others
Bump nim-json-rpc and nimbus-eth2 too.
Reason: both nim-json-rpc and nim-web3 migrate from
stdlib/json to nim-json-serialization
2024-01-14 10:41:23 +07:00
jangko b0000eed8b
Add check copyright year linter to CI 2023-11-01 10:41:20 +07:00
jangko 94a94c5b65 implement better hardfork management 2022-12-02 13:51:42 +07:00
Jacek Sieka c2ed731fa5
eth: adapt to smaller eth_types (#1210) 2022-09-03 20:15:35 +02:00
KonradStaniec 196428dcf5
Use one ws connection to transfer data from source (#1136) 2022-06-22 08:50:58 +02:00
jangko f051c2530e
fixes related to nim-json-rpc bump 2021-11-30 14:13:20 +07:00
jangko e23300e2cc
fix premix tools due to recent changes
- persist: fix related to new config
- parser: add EIP 2930 and EIP 1559 features in parseBlockHeader
  and parseTransaction
- add graphql_downloader as a supplement json-rpc downloader
2021-09-21 13:35:52 +07:00
jangko 14cf2c8cac fixes premix/downloader.nim to compile with new json_rpc 2021-03-19 12:30:00 +07:00
Yuriy Glukhov 19e7d70099 Fixed rpc client api usage 2019-06-24 19:32:34 +03:00
andri lim 72cebff516 add 'DownloadAndValidate' flag to premix downloader 2019-03-13 15:45:33 +02:00
andri lim d21d0814c6 add getAncestorHash to hunter tool 2019-02-22 13:11:28 +02:00
Yuriy Glukhov 481c6cf4ed Use nim-eth (#224) 2019-02-05 20:15:50 +01:00
andri lim f1bb0d1b31 poststate processing 2019-01-15 15:30:25 +02:00
andri lim 7190b218de add premix support tools 2019-01-15 15:30:25 +02:00