• Felix Lange's avatar
    core/types: transaction and receipt encoding/decoding optimizations (#27976) · 9bbb9df1
    Felix Lange authored
    Just some minor optimizations I figured out a while ago. By using ReadBytes instead of
    Bytes on the rlp stream, we can save the allocation of a temporary buffer for the typed tx
    payload.
    
    If kind == rlp.Byte, the size reported by Stream.Kind will be zero, but we need a buffer
    of size 1 for ReadBytes. Since typed txs always have to be longer than 1 byte, we can just
    return an error for kind == rlp.Byte.
    
    There is a also a small change for Log: since the first three fields of Log are the ones that 
    should appear in the canon encoding, we can simply ignore the remaining fields via 
    struct tag. Doing this removes an indirection through the rlpLog type.
    
    ---------
    Co-authored-by: 's avatarMartin Holst Swende <martin@swende.se>
    9bbb9df1
Name
Last commit
Last update
..
asm Loading commit data...
bloombits Loading commit data...
forkid Loading commit data...
rawdb Loading commit data...
state Loading commit data...
txpool Loading commit data...
types Loading commit data...
vm Loading commit data...
.gitignore Loading commit data...
bench_test.go Loading commit data...
block_validator.go Loading commit data...
block_validator_test.go Loading commit data...
blockchain.go Loading commit data...
blockchain_insert.go Loading commit data...
blockchain_reader.go Loading commit data...
blockchain_repair_test.go Loading commit data...
blockchain_sethead_test.go Loading commit data...
blockchain_snapshot_test.go Loading commit data...
blockchain_test.go Loading commit data...
blocks.go Loading commit data...
bloom_indexer.go Loading commit data...
chain_indexer.go Loading commit data...
chain_indexer_test.go Loading commit data...
chain_makers.go Loading commit data...
chain_makers_test.go Loading commit data...
dao_test.go Loading commit data...
error.go Loading commit data...
events.go Loading commit data...
evm.go Loading commit data...
forkchoice.go Loading commit data...
gaspool.go Loading commit data...
gen_genesis.go Loading commit data...
gen_genesis_account.go Loading commit data...
genesis.go Loading commit data...
genesis_alloc.go Loading commit data...
genesis_test.go Loading commit data...
headerchain.go Loading commit data...
headerchain_test.go Loading commit data...
mkalloc.go Loading commit data...
rlp_test.go Loading commit data...
sender_cacher.go Loading commit data...
state_prefetcher.go Loading commit data...
state_processor.go Loading commit data...
state_processor_test.go Loading commit data...
state_transition.go Loading commit data...
types.go Loading commit data...