plugeth/core
Felix Lange d6f49bf764
core/types: faster RLP encoding of Header, StateAcccount, ReceiptForStorage (#24420)
This change makes use of the new code generator rlp/rlpgen to improve the
performance of RLP encoding for Header and StateAccount. It also speeds up
encoding of ReceiptForStorage using the new rlp.EncoderBuffer API.

The change is much less transparent than I wanted it to be, because Header and
StateAccount now have an EncodeRLP method defined with pointer receiver. It
used to be possible to encode non-pointer values of these types, but the new
method prevents that and attempting to encode unadressable values (even if
part of another value) will return an error. The error can be surprising and may
pop up in places that previously didn't expect any errors.

To make things work, I also needed to update all code paths (mostly in unit tests)
that lead to encoding of non-pointer values, and pass a pointer instead.

Benchmark results:

    name                             old time/op    new time/op    delta
    EncodeRLP/legacy-header-8           328ns ± 0%     237ns ± 1%   -27.63%  (p=0.000 n=8+8)
    EncodeRLP/london-header-8           353ns ± 0%     247ns ± 1%   -30.06%  (p=0.000 n=8+8)
    EncodeRLP/receipt-for-storage-8     237ns ± 0%     123ns ± 0%   -47.86%  (p=0.000 n=8+7)
    EncodeRLP/receipt-full-8            297ns ± 0%     301ns ± 1%    +1.39%  (p=0.000 n=8+8)

    name                             old speed      new speed      delta
    EncodeRLP/legacy-header-8        1.66GB/s ± 0%  2.29GB/s ± 1%   +38.19%  (p=0.000 n=8+8)
    EncodeRLP/london-header-8        1.55GB/s ± 0%  2.22GB/s ± 1%   +42.99%  (p=0.000 n=8+8)
    EncodeRLP/receipt-for-storage-8  38.0MB/s ± 0%  64.8MB/s ± 0%   +70.48%  (p=0.000 n=8+7)
    EncodeRLP/receipt-full-8          910MB/s ± 0%   897MB/s ± 1%    -1.37%  (p=0.000 n=8+8)

    name                             old alloc/op   new alloc/op   delta
    EncodeRLP/legacy-header-8           0.00B          0.00B           ~     (all equal)
    EncodeRLP/london-header-8           0.00B          0.00B           ~     (all equal)
    EncodeRLP/receipt-for-storage-8     64.0B ± 0%      0.0B       -100.00%  (p=0.000 n=8+8)
    EncodeRLP/receipt-full-8             320B ± 0%      320B ± 0%      ~     (all equal)
2022-02-18 08:10:26 +01:00
..
asm core/asm: change order of items in stringtokenTypes (#24153) 2021-12-26 14:58:17 +01:00
beacon all: separate catalyst package (#24280) 2022-01-31 14:22:35 +02:00
bloombits all: fix some go-critic linter warnings (#23709) 2021-10-13 17:31:02 +02:00
forkid eth/catalyst: implement kintsugi-spec v3 (#24067) 2021-12-17 15:38:58 +01:00
rawdb core, ethdb, tests, trie: implement NewBatchWithSize API for batcher (#24392) 2022-02-15 15:15:13 +02:00
state core/state: fix read-meters + simplify code (#24304) 2022-02-14 09:22:57 +01:00
types core/types: faster RLP encoding of Header, StateAcccount, ReceiptForStorage (#24420) 2022-02-18 08:10:26 +01:00
vm core/evm: RANDOM opcode (EIP-4399) (#24141) 2022-01-10 09:44:21 +02:00
.gitignore Renamed chain => core 2014-12-04 10:28:02 +01:00
bench_test.go core: fix benchmark tests (#23803) 2021-10-27 13:08:51 +02:00
block_validator_test.go all: core rework for the merge transition (#23761) 2021-11-26 13:23:02 +02:00
block_validator.go cmd, core, eth, miner: deprecate miner.gastarget flag (#23213) 2021-08-10 11:28:33 +03:00
blockchain_insert.go core: fix snapshot missing when recovery from crash (#23496) 2021-11-01 14:09:36 +01:00
blockchain_reader.go core, eth: improve delivery speed on header requests (#23105) 2021-12-07 17:50:58 +01:00
blockchain_repair_test.go core, miner, rpc, eth: fix goroutine leaks in tests (#24211) 2022-01-21 12:22:44 +01:00
blockchain_sethead_test.go eth: request id dispatcher and direct req/reply APIs (#23576) 2021-11-26 13:26:03 +02:00
blockchain_snapshot_test.go core: fix typo in comment (#23658) 2021-09-29 21:28:47 +02:00
blockchain_test.go core: fix typo in blockchain test (#24263) 2022-01-21 09:12:40 +01:00
blockchain.go Merge pull request #24197 from rjl493456442/periodically-flush-batch 2022-01-11 11:32:43 +02:00
blocks.go core: typos and comments improve 2017-05-25 17:14:33 +03:00
bloom_indexer.go eth: move eth.Config to a common package (#22205) 2021-02-05 13:51:15 +01:00
chain_indexer_test.go core: fix potential race in chainIndexerTest (#22346) 2021-03-19 13:32:57 +01:00
chain_indexer.go all: make logs a bit easier on the eye to digest (#22665) 2021-04-15 20:35:00 +03:00
chain_makers_test.go cmd, core, eth: background transaction indexing (#20302) 2020-05-11 18:58:43 +03:00
chain_makers.go eth: request id dispatcher and direct req/reply APIs (#23576) 2021-11-26 13:26:03 +02:00
dao_test.go accounts/abi/bind: fix bounded contracts and sim backend for 1559 (#23038) 2021-06-15 13:56:14 +03:00
error.go core/vm: implement EIP-2681: Limit account nonce to 2^64-1 (#23853) 2021-11-11 15:00:58 +01:00
events.go eth/filters: remove use of event.TypeMux for pending logs (#20312) 2019-12-10 12:39:14 +01:00
evm.go core/evm: RANDOM opcode (EIP-4399) (#24141) 2022-01-10 09:44:21 +02:00
forkchoice.go all: core rework for the merge transition (#23761) 2021-11-26 13:23:02 +02:00
gaspool.go miner: avoid unnecessary work (#15883) 2018-01-15 12:57:06 +02:00
gen_genesis_account.go tests: update for London (#22976) 2021-06-07 14:37:56 +02:00
gen_genesis.go core: change baseFee into baseFeePerGas in genesis json 2021-06-14 14:04:44 +02:00
genesis_alloc.go cmd/geth: add support for sepolia testnet (#23730) 2021-11-08 13:06:01 +02:00
genesis_test.go cmd/geth: add support for sepolia testnet (#23730) 2021-11-08 13:06:01 +02:00
genesis.go core/evm: RANDOM opcode (EIP-4399) (#24141) 2022-01-10 09:44:21 +02:00
headerchain_test.go all: core rework for the merge transition (#23761) 2021-11-26 13:23:02 +02:00
headerchain.go core, eth: improve delivery speed on header requests (#23105) 2021-12-07 17:50:58 +01:00
mkalloc.go all: add go:build lines (#23468) 2021-08-25 18:46:29 +02:00
rlp_test.go core: fix benchmark tests (#23803) 2021-10-27 13:08:51 +02:00
state_prefetcher.go all: removed blockhash from statedb (#23126) 2021-06-30 15:17:01 +02:00
state_processor_test.go core/vm: implement EIP-2681: Limit account nonce to 2^64-1 (#23853) 2021-11-11 15:00:58 +01:00
state_processor.go all: removed blockhash from statedb (#23126) 2021-06-30 15:17:01 +02:00
state_transition.go core/evm: RANDOM opcode (EIP-4399) (#24141) 2022-01-10 09:44:21 +02:00
tx_cacher.go Comment error (#18303) 2018-12-14 11:15:31 +01:00
tx_journal.go core: transaction journal should not be executable (#23090) 2021-06-23 07:29:20 +03:00
tx_list_test.go core: fix benchmark tests (#23803) 2021-10-27 13:08:51 +02:00
tx_list.go core: fixed stale comment in txlist (#23825) 2021-10-28 14:59:51 +02:00
tx_noncer.go core: more efficient nonce-update in txpool (#22231) 2021-11-02 18:32:23 +01:00
tx_pool_test.go core: more efficient nonce-update in txpool (#22231) 2021-11-02 18:32:23 +01:00
tx_pool.go core: ignore basefee when comparing with pool gasprice in txpool (#24080) 2021-12-17 15:44:57 +01:00
types.go core: prefetch next block state concurrently 2019-04-01 11:06:15 +03:00