nimbus-eth1/nimbus/core
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
..
chain Remove EVM indirect imports and unused EVM errors (#2370) 2024-06-17 09:56:39 +02:00
executor Avoid creating database transaction for every block (#2379) 2024-06-17 15:28:44 +02:00
pow rm PoW hash function and validation support (#2372) 2024-06-16 10:22:06 +07:00
tx_pool Coredb maintenance (#2398) 2024-06-19 14:13:12 +00:00
block_import.nim Consolidate block type for block processing (#2325) 2024-06-09 16:32:20 +02:00
casper.nim processBeaconBlockRoot in TxPool(EIP-4788) 2023-10-19 07:50:07 +07:00
chain.nim saner source code grouping 2022-12-02 13:51:42 +07:00
dao.nim Ledger activate unified accounts cache wrapper (#1939) 2023-12-12 19:12:56 +00:00
eip4844.nim Cache code and invalid jump destination tables (fixes #2268) (#2404) 2024-06-21 09:44:10 +02:00
executor.nim avoid initTable (#2328) 2024-06-10 11:05:30 +02:00
gaslimit.nim Bump nim-eth, nim-web3, nimbus-eth2 (#2344) 2024-06-14 14:31:08 +07:00
tx_pool.nim Bump nim-eth, nim-web3, nimbus-eth2 (#2344) 2024-06-14 14:31:08 +07:00
validate.nim rm PoW hash function and validation support (#2372) 2024-06-16 10:22:06 +07:00
withdrawals.nim Bump nim-eth, nim-web3, nimbus-eth2 (#2344) 2024-06-14 14:31:08 +07:00