go-ethereum/rlp
Arran Schlosberg d210cc4fce
refactor(core/types): simplify Body RLP override (#120)
## Why this should be merged

Simplification of `types.Body` RLP overriding, resulting in reduced code
at both the implementation and consumer ends.

## How this works

Introduction of `rlp.Fields` type, to mirror regular RLP encoding of a
struct. The RLP override hook now only needs to return the fields of
interest, which MAY come from either the `Body` or the registered extra.

This pattern allows for arbitrary modification of upstream fields via
(1) reordering; (2) addition; (3) deletion; and (4) inverting required
vs optional status. While less important for `Body`, this allows for
complete support of `ava-labs/coreth` `Header` modifications, which make
use of 1-3.

## How this was tested

Existing backwards-compatibility tests + new unit tests for introduced
functionality.

---------

Signed-off-by: Arran Schlosberg <519948+ARR4N@users.noreply.github.com>
Co-authored-by: Quentin McGaw <quentin.mcgaw@avalabs.org>
2025-02-07 15:42:25 +00:00
..
internal/rlpstruct all: fix docstrings 2022-10-04 09:18:02 +02:00
rlpgen feat: internalise command (#90) 2024-12-17 17:20:02 +01:00
decode.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
decode_tail_test.go all: update license information 2016-04-15 09:48:05 +02:00
decode_test.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
doc.go build: upgrade to go 1.19 (#25726) 2022-09-10 13:25:40 +02:00
encbuffer.go rlp: use identical receiver names for encBuffer methods (#27430) 2023-06-07 12:40:06 +02:00
encbuffer_example_test.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
encode.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
encode_test.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
encoder_example_test.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
fields.libevm.go refactor(core/types): simplify Body RLP override (#120) 2025-02-07 15:42:25 +00:00
fields.libevm_test.go refactor(core/types): simplify Body RLP override (#120) 2025-02-07 15:42:25 +00:00
iterator.go all: add whitespace linter (#25312) 2022-07-25 13:14:03 +03:00
iterator_test.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
list.libevm.go feat(core/types): fine-grained Body RLP override (#109) 2025-02-05 10:52:28 +00:00
list.libevm_test.go feat(core/types): fine-grained Body RLP override (#109) 2025-02-05 10:52:28 +00:00
raw.go p2p/discover: improve discv5 NODES response packing (#26033) 2022-11-07 19:19:02 +01:00
raw_test.go rlp: improve tests for Split functions (#26200) 2022-11-17 14:19:03 +01:00
safe.go rlp: minor optimizations for slice/array encoding (#23467) 2021-08-25 19:01:10 +02:00
typecache.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
unsafe.go rlp: minor optimizations for slice/array encoding (#23467) 2021-08-25 19:01:10 +02:00